mindspore.ops.padding
- mindspore.ops.padding(x, pad_dim_size=8)[source]
Extends the last dimension of the input tensor from 1 to pad_dim_size, by filling with 0.
- Parameters
- Returns
Tensor, has the same type and shape as input shape value.
- Raises
TypeError – If pad_dim_size is not an int.
ValueError – If pad_dim_size is less than 1.
ValueError – If last dim of x is not equal to 1.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> x = Tensor(np.array([[8], [10]]), mindspore.float32) >>> pad_dim_size = 4 >>> output = ops.padding(x, pad_dim_size) >>> print(output) [[ 8. 0. 0. 0.] [10. 0. 0. 0.]]