!38176 Add broadcast_to op chinese doc of tensor api
Merge pull request !38176 from 朱家兴/master
This commit is contained in:
commit
a071790196
|
@ -278,6 +278,25 @@ mindspore.Tensor
|
|||
|
||||
Tensor,是一个与 `x` 相同类型的Tensor。
|
||||
|
||||
.. py:method:: broadcast_to(shape)
|
||||
|
||||
将输入shape广播到目标shape。
|
||||
|
||||
更多细节请参考 :func:`mindspore.ops.broadcast_to` 。
|
||||
|
||||
**参数:**
|
||||
|
||||
- **shape** (tuple) - 要广播的目标形状。可以由用户指定,或在要广播的维度上指定-1,它将被该位置的输入张量形状替换。
|
||||
|
||||
**返回:**
|
||||
|
||||
Tensor, 形状为用户指定的 `shape`,类型和 `self` 相同。
|
||||
|
||||
**异常:**
|
||||
|
||||
- **TypeError** - 如果输入的 `shape` 参数不是tuple类型。
|
||||
- **ValueError** - 如果输入的 `shape` 与 `self` 的形状不兼容,或者目标 `shape` 中的-1位于无效位置。
|
||||
|
||||
.. py:method:: ceil()
|
||||
|
||||
向上取整。
|
||||
|
|
|
@ -10,7 +10,7 @@ mindspore.ops.broadcast_to
|
|||
**参数:**
|
||||
|
||||
- **x** (Tensor) - 第一个输入,任意维度的Tensor,数据类型为float16、float32、int32、int8、uint8、bool。
|
||||
- **shape** (Tensor) - 第二个输入,指定广播到目标 `shape`。
|
||||
- **shape** (Tuple) - 第二个输入,指定广播到目标 `shape`。
|
||||
|
||||
**返回:**
|
||||
|
||||
|
|
|
@ -967,16 +967,12 @@ class Tensor(Tensor_):
|
|||
def broadcast_to(self, shape):
|
||||
"""
|
||||
Broadcasts input tensor to a given shape.
|
||||
Input shape can be broadcast to target shape if for each dimension pair they are either equal or input is
|
||||
one or the target dimension is -1. In case of -1 in target shape, it will be replaced by the input
|
||||
shape's value in that dimension.
|
||||
When input shape is broadcast to target shape, it starts with the trailing
|
||||
dimensions. If there is a -1 in the target shape, the -1 cannot be in a leading,
|
||||
non-existing dimension.
|
||||
|
||||
Refer to :func:`mindspore.ops.broadcast_to` for more detail.
|
||||
|
||||
Args:
|
||||
shape (tuple): The target shape to broadcast. Can be fully specified, or have -1 in one position
|
||||
where it will be substituted by the input tensor's shape in that position, see example.
|
||||
where it will be substituted by the input tensor's shape in that position.
|
||||
|
||||
Returns:
|
||||
Tensor, with the given `shape` and the same data type as `self`.
|
||||
|
|
Loading…
Reference in New Issue