Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K
JAX  documentation - Home

jax.numpy.negative

Contents

jax.numpy.negative#

jax.numpy.negative=<jnp.ufunc'negative'>#

Return element-wise negative values of the input.

JAX implementation ofnumpy.negative.

Parameters:
  • x – input array or scalar.

  • args (ArrayLike)

  • out (None)

  • where (None)

Returns:

An array with same shape and dtype asx containing-x.

Return type:

Any

See also

Note

jnp.negative, when applied overunsignedinteger, produces the resultof their two’s complement negation, which typically results in unexpectedlarge positive values due to integer underflow.

Examples

For real-valued inputs:

>>>x=jnp.array([0.,-3.,7])>>>jnp.negative(x)Array([-0.,  3., -7.], dtype=float32)

For complex inputs:

>>>x1=jnp.array([1-2j,-3+4j,5-6j])>>>jnp.negative(x1)Array([-1.+2.j,  3.-4.j, -5.+6.j], dtype=complex64)

For unit32:

>>>x2=jnp.array([5,0,-7]).astype(jnp.uint32)>>>x2Array([         5,          0, 4294967289], dtype=uint32)>>>jnp.negative(x2)Array([4294967291,          0,          7], dtype=uint32)
Contents

[8]ページ先頭

©2009-2025 Movatter.jp