Skip to content

Commit f5c2946

Browse files
committed
add abs for odd powers
1 parent 0178442 commit f5c2946

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/simple/vectoradd_jax/tesseract_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def apply_jit(inputs: dict) -> dict:
6969
def safe_norm(x, ord):
7070
# Compute the norm of a vector, adding a small epsilon to ensure
7171
# differentiability and avoid division by zero
72-
return jnp.power(jnp.power(x, ord).sum() + 1e-8, 1 / ord)
72+
return jnp.power(jnp.power(jnp.abs(x), ord).sum() + 1e-8, 1 / ord)
7373

7474
return {
7575
"vector_add": {

0 commit comments

Comments
 (0)