Skip to content

Enable half and double for resampler GPU ops #1852

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

Conversation

WindQAQ
Copy link
Member

@WindQAQ WindQAQ commented May 17, 2020

@WindQAQ WindQAQ requested a review from facaiy as a code owner May 17, 2020 08:11
@WindQAQ WindQAQ changed the title Enable half and double for resampler Enable half and double for resampler for GPU May 17, 2020
@WindQAQ WindQAQ changed the title Enable half and double for resampler for GPU Enable half and double for resampler GPU ops May 17, 2020
Copy link
Member

@seanpmorgan seanpmorgan left a comment

Choose a reason for hiding this comment

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

This is puzzling to me. I checked on previous kokoro logs and indeed test_op_backward_pass[gpu-float16] was running and passing.

TFA 0.10 sucessfully performs this as well:

print(data_tensor.dtype)
print(warp_tensor.dtype)
with tf.GradientTape() as g:
	g.watch(data_tensor)
	out = resampler_ops.resampler(data_tensor, warp_tensor)

grad = g.gradient(out, data_tensor)
print(grad[0][:1])
print(out.dtype)
print(grad.dtype)
<dtype: 'float16'>
<dtype: 'float16'>
2020-05-18 21:10:02.200555: I tensorflow/core/common_runtime/placer.cc:114] gradients_resampler_addons_resampler_grad_addons_resamplergrad_0_RetVal: (_Retval): /job:localhost/replica:0/task:0/device:GPU:0
tf.Tensor(
[[[0.4368 0.4368 0.4368]
  [0.9355 0.9355 0.9355]
  [0.     0.     0.    ]
  [0.     0.     0.    ]
  [0.     0.     0.    ]]], shape=(1, 5, 3), dtype=float16)
<dtype: 'float16'>
<dtype: 'float16'>

Regardless the change LGTM... Thanks @WindQAQ!

@seanpmorgan
Copy link
Member

seanpmorgan commented May 19, 2020

@alextp No urgency, but whenever time allows could you or someone you could direct us to take a look at why this was working before. Would like to improve our understanding of the registering mechanism.

Colab link:
https://colab.research.google.com/drive/1o53EPNALyTRFlJGLLZmihlSUfCFDHKUz?usp=sharing

@seanpmorgan seanpmorgan merged commit a159fd4 into tensorflow:master May 19, 2020
ashutosh1919 pushed a commit to ashutosh1919/addons that referenced this pull request Jul 12, 2020
* enable half and double for resampler
* register GPU kernels
* specialize half and double kernels
jrruijli pushed a commit to jrruijli/addons that referenced this pull request Dec 23, 2020
* enable half and double for resampler
* register GPU kernels
* specialize half and double kernels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants