• Clips values element-wise. max(min(x, clipValueMax), clipValueMin)

    const x = tf.tensor1d([-1, 2, -3, 4]);

    x.clipByValue(-2, 3).print(); // or tf.clipByValue(x, -2, 3)

    Type Parameters

    Parameters

    • x: TensorLike | T

      The input tensor.

    • clipValueMin: number

      Lower bound of range to be clipped to.

    • clipValueMax: number

      Upper bound of range to be clipped to.

    Returns T