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

Update transforms.py (#40647)

上级 4d0d0eca
......@@ -327,12 +327,17 @@ class ToTensor(BaseTransform):
import paddle.vision.transforms as T
import paddle.vision.transforms.functional as F
fake_img = Image.fromarray((np.random.rand(224, 224, 3) * 255.).astype(np.uint8))
fake_img = Image.fromarray((np.random.rand(4, 5, 3) * 255.).astype(np.uint8))
transform = T.ToTensor()
tensor = transform(fake_img)
print(tensor.shape)
# [3, 4, 5]
print(tensor.dtype)
# paddle.float32
"""
def __init__(self, data_format='CHW', keys=None):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册