diff --git a/python/paddle/nn/__init__.py b/python/paddle/nn/__init__.py index 12a5cdd0cc54200b24d236ed76b848939344e1e3..3a552d588bed9c1e0b1fb917480e1195c686380d 100644 --- a/python/paddle/nn/__init__.py +++ b/python/paddle/nn/__init__.py @@ -76,6 +76,8 @@ from .layer.common import Embedding #DEFINE_ALIAS from .layer.common import Linear #DEFINE_ALIAS from .layer.common import Flatten #DEFINE_ALIAS from .layer.common import Upsample #DEFINE_ALIAS +from .layer.common import UpsamplingNearest2D #DEFINE_ALIAS +from .layer.common import UpsamplingBilinear2D #DEFINE_ALIAS from .layer.common import Bilinear #DEFINE_ALIAS from .layer.common import Dropout #DEFINE_ALIAS from .layer.common import Dropout2D #DEFINE_ALIAS diff --git a/python/paddle/nn/layer/common.py b/python/paddle/nn/layer/common.py index 389af0b1a875787675a68d1ad28ecea7bc91a6d1..5ae6e3ed770c978ea079596f9669e1bdd81d5b7b 100644 --- a/python/paddle/nn/layer/common.py +++ b/python/paddle/nn/layer/common.py @@ -421,7 +421,7 @@ class UpsamplingNearest2D(layers.Layer): import paddle import paddle.nn as nn - input_data = paddle.rand(2,3,6,10).astype("float32") + input_data = paddle.rand(shape=(2,3,6,10)).astype("float32") upsample_out = paddle.nn.UpsamplingNearest2D(size=[12,12]) input = paddle.to_tensor(input_data) output = upsample_out(x=input) @@ -498,7 +498,7 @@ class UpsamplingBilinear2D(layers.Layer): import paddle import paddle.nn as nn - input_data = paddle.rand(2,3,6,10).astype("float32") + input_data = paddle.rand(shape=(2,3,6,10)).astype("float32") upsample_out = paddle.nn.UpsamplingBilinear2D(size=[12,12]) input = paddle.to_tensor(input_data) output = upsample_out(x=input)