未验证 提交 236a3bc5 编写于 作者: L Liyulingyue 提交者: GitHub

fix paddle.vision.transforms.Resize en docs (#40719)

* Update transforms.py

* Update transforms.py

* Update transforms.py

* Update functional.py
上级 3085d5e4
...@@ -124,9 +124,11 @@ def resize(img, size, interpolation='bilinear'): ...@@ -124,9 +124,11 @@ def resize(img, size, interpolation='bilinear'):
converted_img = F.resize(fake_img, 224) converted_img = F.resize(fake_img, 224)
print(converted_img.size) print(converted_img.size)
# (262, 224)
converted_img = F.resize(fake_img, (200, 150)) converted_img = F.resize(fake_img, (200, 150))
print(converted_img.size) print(converted_img.size)
# (150, 200)
""" """
if not (_is_pil_image(img) or _is_numpy_image(img) or if not (_is_pil_image(img) or _is_numpy_image(img) or
_is_tensor_image(img)): _is_tensor_image(img)):
......
...@@ -395,12 +395,17 @@ class Resize(BaseTransform): ...@@ -395,12 +395,17 @@ class Resize(BaseTransform):
from PIL import Image from PIL import Image
from paddle.vision.transforms import Resize from paddle.vision.transforms import Resize
transform = Resize(size=224) fake_img = Image.fromarray((np.random.rand(256, 300, 3) * 255.).astype(np.uint8))
fake_img = Image.fromarray((np.random.rand(100, 120, 3) * 255.).astype(np.uint8))
fake_img = transform(fake_img) transform = Resize(size=224)
print(fake_img.size) converted_img = transform(fake_img)
print(converted_img.size)
# (262, 224)
transform = Resize(size=(200,150))
converted_img = transform(fake_img)
print(converted_img.size)
# (150, 200)
""" """
def __init__(self, size, interpolation='bilinear', keys=None): def __init__(self, size, interpolation='bilinear', keys=None):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册