Clamp all elements in x into the range -Inf, max and return a resulting tensor.

tch_clamp_max(x, max)

Arguments

x

tensor object

max

upper-bound of the range to be clamped to

Examples

x <- tensor(1:10) tch_clamp_max(x, 5)
#> tensor #> 1 #> 2 #> 3 #> 4 #> 5 #> 5 #> 5 #> 5 #> 5 #> 5 #> [ Variable[CPUIntType]{10} ]