mindspore.ops.Expand
- class mindspore.ops.Expand[source]
Returns a new view of the self tensor with singleton dimensions expanded to a larger size.
Refer to
mindspore.ops.expand()
for more details.- Supported Platforms:
Ascend
CPU
Examples
>>> x = Tensor(np.array([[1], [2], [3]]), mindspore.float32) >>> shape = Tensor(np.array([3,4]), mindspore.int32) >>> expand = ops.Expand() >>> y = expand(x, shape) >>> print(y) [[1. 1. 1. 1.] [2. 2. 2. 2.] [3. 3. 3. 3.]]