Learn R Programming

ggmlR (version 0.6.1)

ag_clamp: Element-wise clamp

Description

Clamps values to [lo, hi]. Gradient is 1 inside the interval, 0 at the boundary (straight-through estimator).

Usage

ag_clamp(x, lo = -Inf, hi = Inf)

Value

ag_tensor

Arguments

x

ag_tensor

lo

Lower bound (default -Inf)

hi

Upper bound (default Inf)