pytorch/vision

Add uint8 support for interpolate and grid-sample in PyTorch

Open

#2,289 建立於 2020年6月5日

在 GitHub 查看
 (4 留言) (6 反應) (1 負責人)Python (6,858 fork)batch import
help wantedhigh prioritymodule: transforms

倉庫指標

Star
 (15,050 star)
PR 合併指標
 (平均合併 12天 8小時) (30 天內合併 14 個 PR)

描述

🚀 Feature

With the addition of torch tensor support for the transforms (following https://github.com/pytorch/vision/issues/1375), there are two operators that will require extra attention in order for them to be as efficient as the PIL implementations.

Indeed, while we can implement resize via torch.nn.functional.interpolate and rotate via torch.nn.functional.grid_sample, those operators for now only support floating-point types, so for now we need to perform a .float() -> interpolate() -> byte() in order to maintain compatibility, which is wasteful.

It would be great if they could be extended to support uint8 (and maybe other integer types) as well.

A first PR adding support for uint8 to nearest mode interpolate has been sent in https://github.com/pytorch/pytorch/pull/35029

Something to keep in mind: the interpolate function is under optimization in https://github.com/pytorch/pytorch/pull/34864, so this should be kept in mind to avoid conflicts.

貢獻者指南