powered by
Renorm
torch_renorm(self, p, dim, maxnorm)
(Tensor) the input tensor.
(float) the power for the norm computation
(int) the dimension to slice over to get the sub-tensors
(float) the maximum norm to keep each sub-tensor under
Returns a tensor where each sub-tensor of input along dimension dim is normalized such that the p-norm of the sub-tensor is lower than the value maxnorm
input
dim
p
maxnorm
if (torch_is_installed()) { x = torch_ones(c(3, 3)) x[2,]$fill_(2) x[3,]$fill_(3) x torch_renorm(x, 1, 1, 5) }
Run the code above in your browser using DataLab