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

TF2.0 AutoGraph issue #32377

Closed
kailanyue opened this issue Sep 10, 2019 · 9 comments
Closed

TF2.0 AutoGraph issue #32377

kailanyue opened this issue Sep 10, 2019 · 9 comments
Assignees
Labels
stat:awaiting response Status - Awaiting response from author TF 2.0 Issues relating to TensorFlow 2.0 type:build/install Build and install issues

Comments

@kailanyue
Copy link

kailanyue commented Sep 10, 2019

OS:Ubuntu 18.04
TensorFlow Version:tensorflow-gpu == 2.0.0-rc0
issue:AutoGraph
WARNING:tensorflow:Entity <function Function._initialize_uninitialized_variables..initialize_variables at 0x7fd89803cef0> could not be transformed and will be executed as-is. Please report this to the AutoGraph team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output. Cause: module 'gast' has no attribute 'Num'
WARNING: Entity <function Function._initialize_uninitialized_variables..initialize_variables at 0x7fd89803cef0> could not be transformed and will be executed as-is. Please report this to the AutoGraph team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output. Cause: module 'gast' has no attribute 'Num'
tf_env.txt

@kailanyue
Copy link
Author

CUDA Version: CUDA 10.0

@2649
Copy link

2649 commented Sep 10, 2019

You should add your code as well. I had the same Issue, but the cause was bug in my code, not of tensorflow.

@ravikyram ravikyram self-assigned this Sep 10, 2019
@ravikyram
Copy link
Contributor

You can try pip install gast==0.2.2 and see if it resolves your issue.

Please, go through the below link and see if it helps you.Thanks!
#32319

@ravikyram ravikyram added the stat:awaiting response Status - Awaiting response from author label Sep 10, 2019
@kailanyue
Copy link
Author

@ravikyram @2649
The problem has been resolved after installing gast. Thanks!

@ravikyram ravikyram added the type:build/install Build and install issues label Sep 19, 2019
@che-shr-cat
Copy link

Got the same issue, it was resolved after installing gast 0.2.2. Previous gast version was 0.3.2

@TommeyChang
Copy link

OS:Ubuntu 16.04
TensorFlow Version:tensorflow-gpu == 2.0.0-rc1
CUDA:10.0
issue:AutoGraph

INFO:tensorflow:Converted call: <function simple_nn_layer at 0x7f6de177c598>
args: (<tf.Tensor 'x:0' shape=(3, 3) dtype=float32>, <tf.Tensor 'y:0' shape=(3, 3) dtype=float32>)
kwargs: {}

Converted call: <function simple_nn_layer at 0x7f6de177c598>
args: (<tf.Tensor 'x:0' shape=(3, 3) dtype=float32>, <tf.Tensor 'y:0' shape=(3, 3) dtype=float32>)
kwargs: {}

INFO:tensorflow:Entity <function simple_nn_layer at 0x7f6de177c598> is not cached for key <code object simple_nn_layer at 0x7f6e085cf540, file "", line 1> subkey (<tensorflow.python.autograph.core.converter.ConversionOptions object at 0x7f6d9a2547f0>, frozenset())
Entity <function simple_nn_layer at 0x7f6de177c598> is not cached for key <code object simple_nn_layer at 0x7f6e085cf540, file "", line 1> subkey (<tensorflow.python.autograph.core.converter.ConversionOptions object at 0x7f6d9a2547f0>, frozenset())
INFO:tensorflow:Converting <function simple_nn_layer at 0x7f6de177c598>
Converting <function simple_nn_layer at 0x7f6de177c598>
INFO:tensorflow:Source code of <function simple_nn_layer at 0x7f6de177c598>:

from future import absolute_import
from future import division
from future import print_function
@tf.function
def simple_nn_layer(x, y):
return tf.nn.relu(tf.matmul(x, y))

Source code of <function simple_nn_layer at 0x7f6de177c598>:

from future import absolute_import
from future import division
from future import print_function
@tf.function
def simple_nn_layer(x, y):
return tf.nn.relu(tf.matmul(x, y))

INFO:tensorflow:Error transforming entity <function simple_nn_layer at 0x7f6de177c598>
Traceback (most recent call last):
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/api.py", line 506, in converted_call
converted_f = conversion.convert(target_entity, program_ctx)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/conversion.py", line 322, in convert
free_nonglobal_var_names)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/conversion.py", line 240, in convert_with_cache
entity, program_ctx)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/conversion.py", line 469, in convert_entity_to_ast
nodes, name, entity_info = convert_func_to_ast(o, program_ctx)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/conversion.py", line 669, in convert_func_to_ast
node = node_to_graph(node, context)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/conversion.py", line 699, in node_to_graph
node = converter.apply
(node, context, function_scopes)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/core/converter.py", line 409, in apply_
node = converter_module.transform(node, context)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/converters/function_scopes.py", line 120, in transform
return FunctionBodyTransformer(ctx).visit(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/core/converter.py", line 346, in visit
return super(Base, self).visit(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/pyct/transformer.py", line 480, in visit
result = super(Base, self).visit(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/ast.py", line 253, in visit
return visitor(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/converters/function_scopes.py", line 87, in visit_FunctionDef
node = self.generic_visit(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/ast.py", line 308, in generic_visit
value = self.visit(value)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/core/converter.py", line 346, in visit
return super(Base, self).visit(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/pyct/transformer.py", line 480, in visit
result = super(Base, self).visit(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/ast.py", line 253, in visit
return visitor(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/converters/function_scopes.py", line 44, in visit_Return
value=node.value)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/pyct/templates.py", line 261, in replace
replacements[k] = _convert_to_ast(replacements[k])
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/pyct/templates.py", line 223, in _convert_to_ast
return gast.Name(id=n, ctx=None, annotation=None)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/gast/gast.py", line 19, in create_node
format(Name, nbparam, len(Fields))
AssertionError: Bad argument number for Name: 3, expecting 4
Error transforming entity <function simple_nn_layer at 0x7f6de177c598>
WARNING:tensorflow:Entity <function simple_nn_layer at 0x7f6de177c598> could not be transformed and will be executed as-is. Please report this to the AutoGraph team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output. Cause: Bad argument number for Name: 3, expecting 4
WARNING: Entity <function simple_nn_layer at 0x7f6de177c598> could not be transformed and will be executed as-is. Please report this to the AutoGraph team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output. Cause: Bad argument number for Name: 3, expecting 4

@bionicles
Copy link

same issue fixed with pip install gast=0.2.2

@zero1666
Copy link

OS:Ubuntu 16.04
TensorFlow Version:tensorflow-gpu == 2.0.0-rc1
CUDA:10.0
issue:AutoGraph

INFO:tensorflow:Converted call: <function simple_nn_layer at 0x7f6de177c598>
args: (<tf.Tensor 'x:0' shape=(3, 3) dtype=float32>, <tf.Tensor 'y:0' shape=(3, 3) dtype=float32>)
kwargs: {}

Converted call: <function simple_nn_layer at 0x7f6de177c598>
args: (<tf.Tensor 'x:0' shape=(3, 3) dtype=float32>, <tf.Tensor 'y:0' shape=(3, 3) dtype=float32>)
kwargs: {}

INFO:tensorflow:Entity <function simple_nn_layer at 0x7f6de177c598> is not cached for key <code object simple_nn_layer at 0x7f6e085cf540, file "", line 1> subkey (<tensorflow.python.autograph.core.converter.ConversionOptions object at 0x7f6d9a2547f0>, frozenset())
Entity <function simple_nn_layer at 0x7f6de177c598> is not cached for key <code object simple_nn_layer at 0x7f6e085cf540, file "", line 1> subkey (<tensorflow.python.autograph.core.converter.ConversionOptions object at 0x7f6d9a2547f0>, frozenset())
INFO:tensorflow:Converting <function simple_nn_layer at 0x7f6de177c598>
Converting <function simple_nn_layer at 0x7f6de177c598>
INFO:tensorflow:Source code of <function simple_nn_layer at 0x7f6de177c598>:

from future import absolute_import
from future import division
from future import print_function
@tf.function
def simple_nn_layer(x, y):
return tf.nn.relu(tf.matmul(x, y))

Source code of <function simple_nn_layer at 0x7f6de177c598>:

from future import absolute_import
from future import division
from future import print_function
@tf.function
def simple_nn_layer(x, y):
return tf.nn.relu(tf.matmul(x, y))

INFO:tensorflow:Error transforming entity <function simple_nn_layer at 0x7f6de177c598>
Traceback (most recent call last):
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/api.py", line 506, in converted_call
converted_f = conversion.convert(target_entity, program_ctx)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/conversion.py", line 322, in convert
free_nonglobal_var_names)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/conversion.py", line 240, in convert_with_cache entity, program_ctx) File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/conversion.py", line 469, in convert_entity_to_ast nodes, name, entity_info = convert_func_to_ast(o, program_ctx) File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/conversion.py", line 669, in convert_func_to_ast node = node_to_graph(node, context) File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/conversion.py", line 699, in node_to_graph node = converter.apply(node, context, function_scopes)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/core/converter.py", line 409, in apply_
node = converter_module.transform(node, context)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/converters/function_scopes.py", line 120, in transform
return FunctionBodyTransformer(ctx).visit(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/core/converter.py", line 346, in visit
return super(Base, self).visit(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/pyct/transformer.py", line 480, in visit
result = super(Base, self).visit(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/ast.py", line 253, in visit
return visitor(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/converters/function_scopes.py", line 87, in visit_FunctionDef
node = self.generic_visit(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/ast.py", line 308, in generic_visit
value = self.visit(value)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/core/converter.py", line 346, in visit
return super(Base, self).visit(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/pyct/transformer.py", line 480, in visit
result = super(Base, self).visit(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/ast.py", line 253, in visit
return visitor(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/converters/function_scopes.py", line 44, in visit_Return
value=node.value)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/pyct/templates.py", line 261, in replace
replacements[k] = _convert_to_ast(replacements[k])
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/pyct/templates.py", line 223, in _convert_to_ast
return gast.Name(id=n, ctx=None, annotation=None)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/gast/gast.py", line 19, in create_node
format(Name, nbparam, len(Fields))
AssertionError: Bad argument number for Name: 3, expecting 4
Error transforming entity <function simple_nn_layer at 0x7f6de177c598>
WARNING:tensorflow:Entity <function simple_nn_layer at 0x7f6de177c598> could not be transformed and will be executed as-is. Please report this to the AutoGraph team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output. Cause: Bad argument number for Name: 3, expecting 4
WARNING: Entity <function simple_nn_layer at 0x7f6de177c598> could not be transformed and will be executed as-is. Please report this to the AutoGraph team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output. Cause: Bad argument number for Name: 3, expecting 4


I meet the same problem, did anyone resolve it in tensorflow2-rc1?

@hagianga21
Copy link

OS:Ubuntu 16.04
TensorFlow Version:tensorflow-gpu == 2.0.0-rc1
CUDA:10.0
issue:AutoGraph
INFO:tensorflow:Converted call: <function simple_nn_layer at 0x7f6de177c598>
args: (<tf.Tensor 'x:0' shape=(3, 3) dtype=float32>, <tf.Tensor 'y:0' shape=(3, 3) dtype=float32>)
kwargs: {}
Converted call: <function simple_nn_layer at 0x7f6de177c598>
args: (<tf.Tensor 'x:0' shape=(3, 3) dtype=float32>, <tf.Tensor 'y:0' shape=(3, 3) dtype=float32>)
kwargs: {}
INFO:tensorflow:Entity <function simple_nn_layer at 0x7f6de177c598> is not cached for key <code object simple_nn_layer at 0x7f6e085cf540, file "", line 1> subkey (<tensorflow.python.autograph.core.converter.ConversionOptions object at 0x7f6d9a2547f0>, frozenset())
Entity <function simple_nn_layer at 0x7f6de177c598> is not cached for key <code object simple_nn_layer at 0x7f6e085cf540, file "", line 1> subkey (<tensorflow.python.autograph.core.converter.ConversionOptions object at 0x7f6d9a2547f0>, frozenset())
INFO:tensorflow:Converting <function simple_nn_layer at 0x7f6de177c598>
Converting <function simple_nn_layer at 0x7f6de177c598>
INFO:tensorflow:Source code of <function simple_nn_layer at 0x7f6de177c598>:
from future import absolute_import
from future import division
from future import print_function
@tf.function
def simple_nn_layer(x, y):
return tf.nn.relu(tf.matmul(x, y))
Source code of <function simple_nn_layer at 0x7f6de177c598>:
from future import absolute_import
from future import division
from future import print_function
@tf.function
def simple_nn_layer(x, y):
return tf.nn.relu(tf.matmul(x, y))
INFO:tensorflow:Error transforming entity <function simple_nn_layer at 0x7f6de177c598>
Traceback (most recent call last):
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/api.py", line 506, in converted_call
converted_f = conversion.convert(target_entity, program_ctx)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/conversion.py", line 322, in convert
free_nonglobal_var_names)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/conversion.py", line 240, in convert_with_cache entity, program_ctx) File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/conversion.py", line 469, in convert_entity_to_ast nodes, name, entity_info = convert_func_to_ast(o, program_ctx) File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/conversion.py", line 669, in convert_func_to_ast node = node_to_graph(node, context) File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/impl/conversion.py", line 699, in node_to_graph node = converter.apply(node, context, function_scopes)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/core/converter.py", line 409, in apply_
node = converter_module.transform(node, context)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/converters/function_scopes.py", line 120, in transform
return FunctionBodyTransformer(ctx).visit(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/core/converter.py", line 346, in visit
return super(Base, self).visit(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/pyct/transformer.py", line 480, in visit
result = super(Base, self).visit(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/ast.py", line 253, in visit
return visitor(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/converters/function_scopes.py", line 87, in visit_FunctionDef
node = self.generic_visit(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/ast.py", line 308, in generic_visit
value = self.visit(value)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/core/converter.py", line 346, in visit
return super(Base, self).visit(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/pyct/transformer.py", line 480, in visit
result = super(Base, self).visit(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/ast.py", line 253, in visit
return visitor(node)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/converters/function_scopes.py", line 44, in visit_Return
value=node.value)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/pyct/templates.py", line 261, in replace
replacements[k] = _convert_to_ast(replacements[k])
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/tensorflow_core/python/autograph/pyct/templates.py", line 223, in _convert_to_ast
return gast.Name(id=n, ctx=None, annotation=None)
File "/home/tommey/anaconda3/envs/tf2.0/lib/python3.6/site-packages/gast/gast.py", line 19, in create_node
format(Name, nbparam, len(Fields))
AssertionError: Bad argument number for Name: 3, expecting 4
Error transforming entity <function simple_nn_layer at 0x7f6de177c598>
WARNING:tensorflow:Entity <function simple_nn_layer at 0x7f6de177c598> could not be transformed and will be executed as-is. Please report this to the AutoGraph team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output. Cause: Bad argument number for Name: 3, expecting 4
WARNING: Entity <function simple_nn_layer at 0x7f6de177c598> could not be transformed and will be executed as-is. Please report this to the AutoGraph team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output. Cause: Bad argument number for Name: 3, expecting 4

I meet the same problem, did anyone resolve it in tensorflow2-rc1?

I also met that problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting response Status - Awaiting response from author TF 2.0 Issues relating to TensorFlow 2.0 type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

9 participants