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

get_static_value does not support tf.identity #37716

Closed
ngc92 opened this issue Mar 19, 2020 · 1 comment
Closed

get_static_value does not support tf.identity #37716

ngc92 opened this issue Mar 19, 2020 · 1 comment
Assignees
Labels
comp:ops OPs related issues TF 2.1 for tracking issues in 2.1 release type:feature Feature requests

Comments

@ngc92
Copy link
Contributor

ngc92 commented Mar 19, 2020

System information

  • TensorFlow version (you are using): 2.1
  • Are you willing to contribute it (Yes/No): Yes

Describe the feature and the current behavior/state.
get_static_value currently cannot see through a tf.identityop, see the following minimal example

>>> @tf.function
... def test():
...     a = tf.constant([5, 4])
...     print(tf.get_static_value(a))
...     b = tf.identity(a)
...     print(tf.get_static_value(b))
...     
>>> test()
[5 4]
None

Will this change the current api? How?
No

Who will benefit with this feature?
I noticed this problem while investigating the reason for tf.sparse.retain losing shape information, even though by definition it should return the same shape as its input. Turns out it constructs a new SparseTensor with dense_shape given by tf.identity(input.dense_shape). There might be other sparse functions with similar problems, but I have not investigated.

I think improving get_static_shape is preferable to providing better shape info for sparse.retain, so for now I am not going to submit a feature request for that.

Any Other info.

@ngc92 ngc92 added the type:feature Feature requests label Mar 19, 2020
@gadagashwini-zz gadagashwini-zz added TF 2.1 for tracking issues in 2.1 release comp:ops OPs related issues labels Mar 20, 2020
@ngc92
Copy link
Contributor Author

ngc92 commented May 13, 2020

this should be fixed with the merging of #38006

@ngc92 ngc92 closed this as completed May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:ops OPs related issues TF 2.1 for tracking issues in 2.1 release type:feature Feature requests
Projects
None yet
Development

No branches or pull requests

3 participants