mindspore.ops.cond
- mindspore.ops.cond(A, p=None)[source]
Return the matrix norm or vector norm of a given tensor.
p is the calculation mode of norm. The following norm modes are supported.
p
norm for matrices
norm for vectors
None(default)2-norm (see below)
2-norm (see below)
'fro'Frobenius norm
– not supported –
'nuc'nuclear norm
– not supported –
inf\(max(sum(abs(x), dim=1))\)
\(max(abs(x))\)
-inf\(min(sum(abs(x), dim=1))\)
\(min(abs(x))\)
0– not supported –
\(sum(x != 0)\)
1\(max(sum(abs(x), dim=0))\)
as below
-1\(min(sum(abs(x), dim=0))\)
as below
2largest singular value
as below
-2smallest singular value
as below
other
intorfloat– not supported –
\(sum(abs(x)^{p})^{(1 / p)}\)
Note
Currently, complex numbers are not supported.
- Parameters
- Returns
Tensor
- Supported Platforms:
GPUCPU
Examples
>>> import mindspore >>> x = mindspore.tensor([[1.0, 0.0, -1.0], [0.0, 1.0, 0.0], [1.0, 0.0, 1.0]]) >>> print(mindspore.ops.cond(x)) 1.4142 >>> print(mindspore.ops.cond(x, 'fro')) 3.1622777