Skip to content

F_t add factor nonnegativity checks for adjust_* #2356

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

Merged
merged 5 commits into from
Jun 30, 2020
Merged

Conversation

ssnl
Copy link
Contributor

@ssnl ssnl commented Jun 27, 2020

No description provided.

Copy link
Member

@fmassa fmassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the improvements @ssnl !

Test failures are related, looks like the optimization using lerp is not supported with torchscript.
Can you revert those changes? I think it's fine to use the unfused ops, as torchscript can most probably fuse everything into a single call anyway.

Comment on lines 293 to 296
if img1.dtype in [torch.half, torch.float32, torch.float64]:
return torch.lerp(ratio, img2, img1).clamp(0, 1).to(img1.dtype)
else:
return torch.lerp(ratio, img2.float(), img1.float()).clamp(0, 255).to(img1.dtype)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like torchscript might not support this overload yet. Can you revert those changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated!

Copy link
Member

@fmassa fmassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @ssnl !

@fmassa
Copy link
Member

fmassa commented Jun 29, 2020

Test failures seems related, can you fix those?

if not _is_tensor_a_torch_image(img):
raise TypeError('tensor is not a torch image.')

mean = torch.mean(rgb_to_grayscale(img).to(torch.float))
mean = rgb_to_grayscale(img).mean()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mean is currently not supported for uint8 types. I think this will be soon fixed in PyTorch, but in the meantime, can you revert this change as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted!

Copy link
Member

@fmassa fmassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @ssnl !

@fmassa fmassa merged commit 7fd2491 into master Jun 30, 2020
@fmassa fmassa deleted the SsnL-patch-2 branch June 30, 2020 13:28
de-vri-es pushed a commit to fizyr-forks/torchvision that referenced this pull request Aug 4, 2020
* F_t add factor nonnegativity checks for adjust_*

* Update functional_tensor.py

* Update functional_tensor.py

* Update functional_tensor.py

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

Successfully merging this pull request may close these issues.

2 participants