Ask questionsAutoGraph 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.


Answer questions mdanatg

Backslash continuations should now be properly supported; the fix is in tf-nightly and will be available in TF 2.2.


Related questions

ModuleNotFoundError: No module named 'tensorflow.contrib' hot 8
Error occurred when finalizing GeneratorDataset iterator hot 6
ModuleNotFoundError: No module named 'tensorflow.contrib'
When importing TensorFlow, error loading Hadoop
tensorflow-gpu CUPTI errors hot 4
[TF 2.0] tf.keras.optimizers.Adam hot 4
Lossy conversion from float32 to uint8. Range [0, 1]. Convert image to uint8 prior to saving to suppress this warning. hot 4
TF2.0 AutoGraph issue hot 4
Tf.Keras metrics issue hot 4
module 'tensorflow' has no attribute 'ConfigProto' hot 4
TF 2.0 'Tensor' object has no attribute 'numpy' while using .numpy() although eager execution enabled by default hot 4
ModuleNotFoundError: No module named 'tensorflow.examples.tutorials' hot 4
AttributeError: module &#39;tensorflow.python.framework.op_def_registry&#39; has no attribute &#39;register_op_list&#39; hot 4
tf.keras.layers.Conv1DTranspose ? hot 4
tensorflow2.0 detected 'xla_gpu' , but 'gpu' expected hot 3
Github User Rank List