mindspore.ops.renorm
- mindspore.ops.renorm(input, p, axis, maxnorm)[source]
Returns a tensor where each subtensor along the specified dimension is renormalized such that its p norm is less than or equal to maxnorm. If the p norm exceeds maxnorm, return the values that are obtained by dividing the original values of the subtensor by its p norm and then multiplying by maxnorm.
- Parameters
- Returns
Tensor
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> input = mindspore.tensor([[1., 1, 1], [2, 2, 2], [3, 3, 3]]) >>> output = mindspore.ops.norm(input, 1, 1) >>> print(output) [3. 6. 9.] >>> output = mindspore.ops.renorm(input, 1, 0, 6.) >>> print(output) [[1. 1. 1.] [2. 2. 2.] [2. 2. 2.]]