mindspore.ops.expand_dims
- mindspore.ops.expand_dims(input_x, axis)[source]
- Adds an additional axis to input tensor. - Note - The dimension of input_x should be greater than or equal to 1. 
- If the specified axis is a negative number, the index is counted backward from the end and starts at 1. 
 - Parameters
- Returns
- Tensor 
 - Supported Platforms:
- Ascend- GPU- CPU
 - Examples - >>> import mindspore >>> input_tensor = mindspore.tensor([[2, 2], [2, 2]], mindspore.float32) >>> output = mindspore.ops.expand_dims(input_tensor, 0) >>> print(output) [[[2. 2.] [2. 2.]]]