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

29 lines
978 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)
计算两个tensor的p-范数距离。
.. note::
结合ReverseV2算子可以得到一个反对角线为1的Tensor但是目前ReverseV2算子只支持Ascend和GPU平台。
**参数:**
- **x** (tensor) - 输入tensor x输入shape [B, P, M]。
- **y** (tensor) - 输入tensor y输入shape [B, R, M]。
- **p** (float) - P -范数距离的P值P∈[0∞]。默认值:2.0。
**返回:**
Tensorp-范数距离, shape为[B, R, M]。
**异常:**
- **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。