Skip to content
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

Is there a way for tensorflow's scatter_nd_update to work with indices of type tf.int64 instead of tf.int32? #40

Open
BoubakerA opened this issue Apr 28, 2022 · 2 comments

Comments

@BoubakerA
Copy link

I'm working with a tf.Variable for which I need to update the values using the scatter_nd_update function. The problem is that my variable has a number of elements equals to 512x512x2048x7 = 3 758 096 384 which is larger than the range converd by int32 (2147483647). And apparently the scatter_nd_update function works only with tf.int32 number and does not work with tf.int64.

Here is an example of the code that produces an overflow error:

import tensorflow as tf

image = tf.Variable(tf.ones((512,512,2048,7), dtype=tf.float32))

update = tf.constant([0.0])
index = tf.constant([[0,0,0,0]], dtype=tf.int64)
image.scatter_nd_update(index, update)

print(f"image shape {tf.shape(image)}")

The error that is raised is the following:
F ./tensorflow/core/util/gpu_launch_config.h:129] Check failed: work_element_count > 0 (-536870912 vs. 0) Aborted (core dumped)

Do you have any idea about how this problem can be resolved?

@BoubakerA BoubakerA changed the title Is there a way for tensorflow's scatter_nd_update to work with indices of type tf.int64 instead on tf.int32? Is there a way for tensorflow's scatter_nd_update to work with indices of type tf.int64 instead of tf.int32? Apr 28, 2022
@gototophao
Copy link

i also met this problem, have you solved it?

@BoubakerA
Copy link
Author

i also met this problem, have you solved it?

No, I didn't.

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

No branches or pull requests

2 participants