Function copysign

  • Calculates:

    output = other >= 0 ? abs(input) : -abs(input)
    

    Gradient:

    var dir = other >= 0 ? (input >= 0 ? 1.0 : -1.0) : (input >= 0 ? -1.0 : 1.0); inputGrad = input == 0.0 ? 0.0 : outputGrad * dir; otherGrad = 0
    

    Parameters

    • input: Tensor

      the input tensor of any shape

    • other: number | Tensor

      the other tensor whose shape is broadcastable with the input tensor

    Returns Tensor

    the output tensor

Generated using TypeDoc