tensorflow: AutoGraph unexpected indent in tf-nightly-gpu-2.1.0.dev20191103
System information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
- TensorFlow installed from (source or binary): binary
- TensorFlow version (use command below):
tf-nightly-gpu-2.1.0.dev20191103 - Python version: 3.5.2
- CUDA/cuDNN version: 10.0/7.1
- GPU model and memory: GTX 1080 Ti
Describe the current behavior
After upgrading to tf-nightly-gpu-2.1.0.dev20191103 from tensorflow-gpu-2.0.0, I obtained this error when running my code:
WARNING:tensorflow:AutoGraph could not transform <bound method CRFLayer.mean_field of <models.crf_layer.CRFLayer object at 0x7f6124237b00>> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output.
Cause: unexpected indent (<unknown>, line 36)
I did export AUTOGRAPH_VERBOSITY=10 but did not observe any other types of output other than the above. It says unexpected indent so I guess something changed in the parsing of Python code when building the graph? The problem does not occur on tensorflow-gpu-2.0.0 (I installed tf-nightly-gpu-2.1.0.dev20191103 because I need to be able to load_weights(pretrained_weights, by_name=True, skip_mismatch=True), which is not available in 2.0.0. There is another bug with this function that I will report in a separate issue.)
Describe the expected behavior Like in TF 2.0.0: no AutoGraph warning.
Code to reproduce the issue Unfortunately my code has a lot of dependencies and I was unable to create a minimal reproducible example. But from the warning message I guess it’s easy enough to check in the source code.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 17 (2 by maintainers)
Backslash continuations should now be properly supported; the fix is in tf-nightly and will be available in TF 2.2.
Thank you, and sorry for the delay. It looks like the warning is caused by the same bug as #35765. Removing the backslash continuations worked in my tests. Until that’s fixed, any of these workarounds should silence the warning:
Note that you can use parentheses to break expressions on multiple lines, as alternative to backslash continuations.