mindspore.nn.Upsample
- class mindspore.nn.Upsample(size=None, scale_factor=None, mode='nearest', align_corners=None, recompute_scale_factor=None)[源代码]
详情请参考
mindspore.ops.interpolate()
。- 支持平台:
Ascend
GPU
CPU
样例:
>>> x = Tensor([[[[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]]]]) >>> upsample = nn.Upsample(size=(5, 5)) >>> out = upsample(x) >>> print(x.asnumpy()) [[[[1. 2. 3. 4.] [5. 6. 7. 8.]]]] >>> print(out.asnumpy()) [[[[1. 1. 2. 3. 4.] [1. 1. 2. 3. 4.] [1. 1. 2. 3. 4.] [5. 5. 6. 7. 8.] [5. 5. 6. 7. 8.]]]] >>> print(out.shape) (1, 1, 5, 5)