-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Conversation
There was a problem hiding this 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.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated!
There was a problem hiding this 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 !
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() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted!
There was a problem hiding this 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 !
* F_t add factor nonnegativity checks for adjust_* * Update functional_tensor.py * Update functional_tensor.py * Update functional_tensor.py * Update functional_tensor.py
No description provided.