mindspore.ops.dist
- mindspore.ops.dist(input, other, p=2)[source]
Computes batched the \(p\)-norm distance between each pair of the two collections of row vectors.
Note
Since only normalization for integer \(p\)-normal form is supported in MindSpore, a type error will be raised if \(p\) is not an integer.
- Parameters
- Returns
Tensor, has the same dtype as input, which shape is \((1)\).
- Raises
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> from mindspore import Tensor, ops >>> input_x = Tensor([[[1.0, 1.0], [2.0, 2.0]]]) >>> input_y = Tensor([[[3.0, 3.0], [3.0, 3.0]]]) >>> out = ops.dist(input_x, input_y) >>> print(out.asnumpy()) 3.1622777