mindspore.ops.ExpandDims

class mindspore.ops.ExpandDims[source]

Adds an additional dimension to input_x at the given axis.

Refer to mindspore.ops.expand_dims() for more detail.

Supported Platforms:

Ascend GPU CPU

Examples

>>> input_tensor = Tensor(np.array([[2, 2], [2, 2]]), mindspore.float32)
>>> expand_dims = ops.ExpandDims()
>>> output = expand_dims(input_tensor, 0)
>>> print(output)
[[[2. 2.]
  [2. 2.]]]