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

TensorArray issues in XLA #42878

Open
yongwww opened this issue Sep 2, 2020 · 4 comments
Open

TensorArray issues in XLA #42878

yongwww opened this issue Sep 2, 2020 · 4 comments
Assignees
Labels
comp:xla XLA stat:awaiting tensorflower Status - Awaiting response from tensorflower TF 2.11 Issues related to TF 2.11 type:bug Bug

Comments

@yongwww
Copy link
Contributor

yongwww commented Sep 2, 2020

Please make sure that this is a bug. As per our
GitHub Policy,
we only address code/doc bugs, performance issues, feature requests and
build/installation issues on GitHub. tag:bug_template

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: NA
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): 2.3 (exists in 1.5 as well)
  • Python version: 3.7.6
  • Bazel version (if compiling from source): NA
  • GCC/Compiler version (if compiling from source): NA
  • CUDA/cuDNN version: NA
  • GPU model and memory: NA

You can collect some of this information using our environment capture
script
You can also obtain the TensorFlow version with:

  1. TF 1.0: python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"
  2. TF 2.0: python -c "import tensorflow as tf; print(tf.version.GIT_VERSION, tf.version.VERSION)"

Describe the current behavior
I know it was documented in xla official doc that xla doesn't support TensorArray with dynamic_size=True, however, I still ran into issues even w/ dynamic_size=False(it is default).

Describe the expected behavior
expect the tensorarray related stuffs are supported.

Standalone code to reproduce the issue
Provide a reproducible test case that is the bare minimum necessary to generate
the problem. If possible, please share a link to Colab/Jupyter/any notebook.

import numpy as np
import tensorflow as tf
tf.compat.v1.enable_eager_execution()

@tf.function(experimental_compile=True)
def test_tensor_array_scatter_gather():
    dtype = "float32"
    t = tf.constant(np.array([[1.0], [2.0], [3.0]]).astype(dtype))
    scatter_indices = tf.constant([2, 1, 0])
    gather_indices = tf.constant([1, 2])
    ta1 = tf.TensorArray(dtype=dtype, size=3, infer_shape=True)
    ta2 = ta1.scatter(scatter_indices, t)
    t1 = ta2.gather(gather_indices)
    return t1

test_tensor_array_scatter_gather()

Other info / logs Include any logs or source code that would be helpful to
diagnose the problem. If including tracebacks, please include the full
traceback. Large logs and files should be attached.

@ravikyram
Copy link
Contributor

@yongwww

I have tried in colab with TF versions 2.3, nightly versions(2.4.0-dev20200831) and was able to reproduce the issue.If I change
@tf.function(experimental_compile=True) to @tf.function i am not seeing any issue.Looks like it does not utilize XLA.Please, find the gist here..Thanks!

@ravikyram ravikyram added comp:xla XLA TF 2.3 Issues related to TF 2.3 labels Sep 2, 2020
@ravikyram ravikyram assigned jvishnuvardhan and unassigned ravikyram Sep 2, 2020
@yongwww
Copy link
Contributor Author

yongwww commented Sep 2, 2020

@ravikyram yeah, I think @tf.function doesn't use XLA either.

@yongwww
Copy link
Contributor Author

yongwww commented Sep 2, 2020

I have several other tensorarray test cases, will run into similar issues with all of them, I can upload some of them if needed.

@jvishnuvardhan jvishnuvardhan assigned r4nt and unassigned jvishnuvardhan Sep 2, 2020
@jvishnuvardhan jvishnuvardhan added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Sep 2, 2020
@sachinprasadhs
Copy link
Contributor

sachinprasadhs commented Jun 3, 2021

Was able to reproduce your issue in TF 2.11, please find the gist here. Thanks!

@SuryanarayanaY SuryanarayanaY added TF 2.11 Issues related to TF 2.11 and removed TF 2.3 Issues related to TF 2.3 labels Dec 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:xla XLA stat:awaiting tensorflower Status - Awaiting response from tensorflower TF 2.11 Issues related to TF 2.11 type:bug Bug
Projects
None yet
Development

No branches or pull requests

6 participants