Skip to main content

Clamp

Clamp(min_val=None, max_val=None)

Clamps every element of input into [min_val, max_val]; an unset bound leaves that side open.

The module form of clika_runtime.clamp: construct it once with the settings, then call it like a function.

Args: min_val: the lower bound: a scalar or a tensor; unset leaves the side open; None takes the function's own default. max_val: the upper bound: a scalar or a tensor; unset leaves the side open; None takes the function's own default.

__init__​

__init__(self, min_val: 'Tensor | float | int | None' = None, max_val: 'Tensor | float | int | None' = None) -> 'None'

Initialize self. See help(type(self)) for accurate signature.

extra_repr​

extra_repr(self) -> 'str'

extra_repr() -> str

One line of per-class detail for :meth:__repr__; a layer prints its geometry here (in_features=64, out_features=256).

forward​

forward(self, input: 'Tensor') -> 'Tensor'

forward(input) -> Tensor

Runs clika_runtime.clamp on input with the stored settings; returns a new tensor.