-
Notifications
You must be signed in to change notification settings - Fork 74k
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.print() with XLA compilation #52944
Comments
Could you please provide the code for which you are facing error. Thanks! |
` @tf.function(jit_compile=True) print_ten() |
Why not
|
Normal print functions works without any limitations, please find the gist here. Thanks! |
The problem is that with normal print, the print statements are only executed on the first call to the function if the function is called multiple times with the same arguments (since tf will use an already made graph, which does not include the calls to print) - (please see https://www.tensorflow.org/guide/function under section "what is tracing?" for details) tf.print() on the other hand will always print in graph mode (without XLA), even on non-first calls. However, tf.print() is not currently supported when XLA compilation is used. Hope this clarifies the nature of the problem -please do let me know if you need more info/code examples of the issue. |
For example, `import tensorflow as tf @tf.function(jit_compile=True) print_ten() |
Yes if you want to print on every function call it is not supported. You can print the returned value outside of the compiled function. |
Yup - that's why I made a feature request for adding tf.print() to the supported ops for XLA compilation. |
Is there a technical reason why |
@sachinprasadhs any updates on this please?
|
@MIHIRKHAMBETE ! |
@sachinprasadhs Please help forward this to XLA or ML API team. Debugging graph mode issues often relies on |
Please make sure that this is a feature request. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:feature_template
Hello,
Does anyone know whether tf.print (or an equivalent workaround) can be made to work with XLA compilation? I get an error saying that XLA does not recognize the "printV2" operation if I have a tf.print statement inside a function decorated with @tf.function(jit_compile=True).
If this functionality does not exist, would like to request that it be added as a new feature!
Thanks!
System information
Describe the feature and the current behavior/state.
tf.print() does not seem to work when used within functions that are compiled with XLA ( decorated with @tf.function(jit_compile=True)
Will this change the current api? How?
No
Who will benefit with this feature?
Users of XLA-compiled tensorflow code.
Any Other info.
The text was updated successfully, but these errors were encountered: