Copies the sign of each element in x2
to the corresponding element in x1
.
JAX implementation of numpy.copysign
.
x1 (ArrayLike) – Input array
x2 (ArrayLike) – The array whose elements will be used to determine the sign, must be broadcast-compatible with x1
An array object containing the potentially changed elements of x1
, always promotes to inexact dtype, and has a shape of jnp.broadcast_shapes(x1.shape, x2.shape)
Examples
>>> x1 = jnp.array([5, 2, 0]) >>> x2 = -1 >>> jnp.copysign(x1, x2) Array([-5., -2., -0.], dtype=float32)
>>> x1 = jnp.array([6, 8, 0]) >>> x2 = 2 >>> jnp.copysign(x1, x2) Array([6., 8., 0.], dtype=float32)
>>> x1 = jnp.array([2, -3]) >>> x2 = jnp.array([[1],[-4], [5]]) >>> jnp.copysign(x1, x2) Array([[ 2., 3.], [-2., -3.], [ 2., 3.]], dtype=float32)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4