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
tf.math.bincount can only sum integer weights when using XLA #908
Comments
@jerryyin can you help review this issue for our current XLA implementation? |
@roblem Thanks for reporting the problem. I digged the history a little bit and think this might be a fairly recent regression in IR-emitter changes. It has already been fixed in tensorflow#36187. Could you try with |
@roblem This is a question for @sunway513. In order for him to determine if the latest docker is up-to-date, we will need your image hash (Did you pull it most recently?). The latest tag for |
Hi @roblem , the |
Wait, upstream TF actually applied the patch internally, and the fix is actually part of the TF r2.2 release branch. |
Apologies for the delay. My workstation is running a memory constrained tensorflow job right now and I project it will take approximately 2 weeks to complete. Then I can try this. |
Closing the issue now as a viable solution has already been given. Please feel free to comment/re-open if the image turns out to be not working. |
I can confirm that all my tests pass with |
System information
Have I written custom code (as opposed to using a stock
example script provided in TensorFlow): Yes.
OS Platform and Distribution
Linux Ubuntu 18.04 using upstream radeon kernel driver and launching ROCM scripts in the latest docker container using
TF_ROCM_FUSION_ENABLE=1
Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if
N/A
TensorFlow installed from (source or
binary): installed from docker as
rocm/tensorflow:latest
TensorFlow version (use command below): v2.1.0-15-g5466af3 2.1.0
Python version: 3.5.2
Bazel version (if compiling from source): Build label: 0.29.1
GCC/Compiler version (if compiling from source): gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
CUDA/cuDNN version:
GPU model and memory: Radeon VII gfx906
Describe the current behavior
From the documentation here
tf.math.bincount
can accept weights as an argument. These weights can be integer or floats. According to the documentation, if the optional dtype argument isn't given, then the output data is assigned a dtype equal to the dtype of weights.This isn't currently happening with bincount under XLA compilation. Bincount will only successfully apply weights if they are integers. It will neither use the dtype of the weights variable nor will it assign dtype if it is supplied as an optional argument.
Standalone code to reproduce the issue
Here is some example code with output:
yields
Running with weights that are integers on XLA yields same results:
Now try a weights vector that is a float using non-xla:
And with XLA, the command fails with this at the bottom:
It seems that the code generated by XLA is trying to force the results of bincount into an integer dtype. I should also mention that adding the optional
dtype
to the bincount functions results in the same errors (so is ignored during code generation).The text was updated successfully, but these errors were encountered: