mindspore/docs/api/api_python/ops/mindspore.ops.func_cdist.rst

23 lines
949 B
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.cdist
===================
.. py:function:: mindspore.ops.cdist(x, y, p=2.0)
批量计算两个Tensor每一批次所有向量两两之间的p-范数距离。
参数:
- **x** (Tensor) - 输入tensor x输入shape [B, P, M]B维度可以为0即shape为 [P, M]。
- **y** (Tensor) - 输入tensor y输入shape [B, R, M]。
- **p** (float) - P -范数距离的P值P∈[0∞]。默认值:2.0。
返回:
Tensorp-范数距离shape为[B, P, R]。
异常:
- **TypeError** - `input_x``input_x` 不是Tensor。
- **TypeError** - `input_x``input_y` 的数据类型不是float16也不是float32。
- **TypeError** - `p` 不是float32。
- **ValueError** - `p` 是负数。
- **ValueError** - `input_x``input_y` 维度不同。
- **ValueError** - `input_x``input_y` 的维度不是2也不是3。