Clamp

class Clamp<T : DType, V>(ctx: ExecutionContext, val min: Float, val max: Float) : TensorTransform<T, V> (source)

Clamps tensor values to a specified range.

output = clamp(input, min, max)

Values below min are set to min, values above max are set to max.

Parameters

ctx

The execution context for tensor operations

min

The minimum value (inclusive)

max

The maximum value (inclusive)

Type Parameters

T

The tensor data type

V

The value type

Constructors

Link copied to clipboard
constructor(ctx: ExecutionContext, min: Float, max: Float)

Properties

Link copied to clipboard
val max: Float
Link copied to clipboard
val min: Float

Functions

Link copied to clipboard
open override fun apply(input: Tensor<T, V>): Tensor<T, V>

Applies this transformation to the given input.

Link copied to clipboard
open override fun toString(): String