mindspore.nn.ResizeBilinear

class mindspore.nn.ResizeBilinear(half_pixel_centers=False)[源代码]

nn.ResizeBilinear 从2.0版本开始已被弃用,并将在未来版本中被移除,建议使用 mindspore.ops.ResizeBilinearV2mindspore.ops.interpolate 代替。

支持平台:

Deprecated

样例:

>>> import mindspore
>>> from mindspore import Tensor, nn
>>> x = Tensor([[[[1, 2, 3, 4], [5, 6, 7, 8]]]], mindspore.float32)
>>> resize_bilinear = nn.ResizeBilinear()
>>> result = resize_bilinear(x, size=(5,5))
>>> print(x)
[[[[1. 2. 3. 4.]
   [5. 6. 7. 8.]]]]
>>> print(result)
[[[[1.        1.8       2.6       3.4       4.       ]
   [2.6       3.4       4.2000003 5.        5.6000004]
   [4.2       5.0000005 5.8       6.6       7.2      ]
   [5.        5.8       6.6       7.4       8.       ]
   [5.        5.8       6.6       7.4000006 8.       ]]]]
>>> print(result.shape)
(1, 1, 5, 5)