[ 仅 API 调用方式不一致 ]torchvision.transforms.functional.perspective

torchvision.transforms.functional.perspective

torchvision.transforms.functional.perspective(img, startpoints, endpoints, interpolation=torchvision.transforms.functional.InterpolationMode.BILINEAR, fill=None)

paddle.vision.transforms.perspective

paddle.vision.transforms.perspective(img, startpoints, endpoints, interpolation='nearest', fill=0)

两者功能一致,但调用方式不一致,具体如下:

转写示例

# PyTorch 写法
result = torchvision.transforms.functional.perspective(
    img, startpoints, endpoints, torchvision.transforms.InterpolationMode.BILINEAR, fill
)

# Paddle 写法
result = paddle.vision.transforms.perspective(
    img, startpoints, endpoints, torchvision.transforms.InterpolationMode.BILINEAR, fill
)