mindspore.mint.unsqueeze
- mindspore.mint.unsqueeze(input, dim)[source]
Adds an additional dimension to the input tensor at the given dimension.
- Supported Platforms:
Ascend
Examples
>>> import mindspore >>> input = mindspore.tensor([1, 2, 3, 4]) >>> mindspore.mint.unsqueeze(input, 0) Tensor(shape=[1, 4], dtype=Int64, value= [[1, 2, 3, 4]]) >>> mindspore.mint.unsqueeze(input, 1) Tensor(shape=[4, 1], dtype=Int64, value= [[1], [2], [3], [4]])