Skip to Content

sign_op

View the code on GitHub

Structs

Struct: Sign

Fields

Methods

fwd(arg0: Array) -> Array
Computes the sign function of the input array element-wise.
Args
  • arg0: Array The input array.
Returns
  • Array - An array containing the sign function of each element in the input array.

Examples:

a = Array([[1, 2], [3, 4]]) result = sign(a) print(result)

Note: This function supports:

  • Complex valued arguments.
jvp(primals: List[Array], tangents: List[Array]) -> Array
more details
Args
  • primals: List[Array]

  • tangents: List[Array]

Returns
  • Array
vjp(primals: List[Array], grad: Array, out: Array) -> List[Array]
more details
Args
  • primals: List[Array]

  • grad: Array

  • out: Array

Returns
  • List[Array]
unary_simd_op(arg0_real: SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], arg0_imag: SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]) -> Tuple[SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]]
Low-level function to compute the sign function of a complex number represented as SIMD vectors.
Args
  • arg0_real: SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)] The real part of the complex number.

  • arg0_imag: SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)] The imaginary part of the complex number.

Returns
  • Tuple[SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)], SIMD[float32, nelts[::DType]().__mul__(2).__floordiv__(2)]] - The real and imaginary parts of the sign function of the complex number as a tuple.
__call__(mut curr: Array, args: List[Array])
Performs the forward pass for element-wise sign function computation of an array.
Args
  • curr: Array The current array to store the result (modified in-place).

  • args: List[Array] A list containing the input array.

Computes the sign function of each element in the input array and stores the result in the current array. Initializes the current array if not already set up.

Note: This function assumes that the shape and data of the args are already set up. If the current array (curr) is not initialized, it computes the shape based on the input array and sets up the data accordingly.

Functions

sign

sign(arg0: Array) -> Array
Computes the sign function of the input array element-wise.
Args
  • arg0: Array The input array.
Returns
  • Array - An array containing the sign function of each element in the input array.

Examples:

a = Array([[1, 2], [3, 4]]) result = sign(a) print(result)

Note: This function supports:

  • Complex valued arguments.
Last updated on