Skip to content

Affine Transform: why is translate a list[int] when the code suggests it could be floating point? #3293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
varung opened this issue Jan 26, 2021 · 3 comments

Comments

@varung
Copy link

varung commented Jan 26, 2021

img: Tensor, angle: float, translate: List[int], scale: float, shear: List[float],

cc @vfdev-5

@varung
Copy link
Author

varung commented Jan 26, 2021

translate_f = [1.0 * t for t in translate]

This line converts the translation into floating point...it seems like we should be able to pass in floating point list

@voldemortX
Copy link
Contributor

voldemortX commented Jan 26, 2021

@varung I think I can give you some preliminary insight on this matter before someone knows more about this comes in later.

Translation is just defined as integer for this transform:

translate (sequence of integers): horizontal and vertical translations (post-rotation translation)

But the matrix getter takes float inputs:

center: List[float], angle: float, translate: List[float], scale: float, shear: List[float]

For tensor transforms, we need to consider torchscript support as well, which means the data type needs to be consistent, hence the conversion to float.
You can see here the PIL transform does not use a conversion.

@vfdev-5
Copy link
Collaborator

vfdev-5 commented Jan 26, 2021

@voldemortX thanks for explaining tech things!

@varung in addition to what @voldemortX said about type consistency, yes, we may also think about having translate API as float to support subpixel translations...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants