question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

module 'tensorflow_core._api.v2.nn' has no attribute 'rnn_cell

See original GitHub issue

Code does not work with the latest Tensorflow library:

Traceback (most recent call last):
  File "/Users/XXXXX/opt/anaconda2/envs/XXXXXX/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/XXXXX/opt/anaconda2/envs/XXXXXX/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/XXXXX/Model/nmt/nmt.py", line 28, in <module>
    from . import inference
  File "/Users/XXXXX/Model/nmt/inference.py", line 25, in <module>
    from . import gnmt_model
  File "/Users/XXXXX/Model/nmt/gnmt_model.py", line 216, in <module>
    class GNMTAttentionMultiCell(tf.nn.rnn_cell.MultiRNNCell):
AttributeError: module 'tensorflow_core._api.v2.nn' has no attribute 'rnn_cell'

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
nashidcommented, May 25, 2020

@parikshit-ai I presume you meant its not working with 2.1.x?

If you found a solution, do keep us posted.

1reaction
luozhouyangcommented, Jun 6, 2020

This code is not for tensorflow 2.x. tensorflow 2.x has many break changes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tensorflow error in import tf.nn.rnn_cell - Stack Overflow
I faced with this error: AttributeError: module 'tensorflow_core._api.v2.nn' has no attribute 'rnn_cell'. Finally, I replaced tf.nn.rnn_cell ...
Read more >
tf.compat.v1.nn.rnn_cell.MultiRNNCell | TensorFlow v2.11.0
if cells is empty (not allowed), or at least one of the cells returns a state tuple but the flag state_is_tuple is False...
Read more >
module 'tensorflow_core._api.v2.nn' has no attribute 'rnn_cell'
TF2.1+Python3.6报错代码cell = tf.nn.rnn_cell.BasicRNNCell(num_units=128)报错信息AttributeError: module 'tensorflow_core._api.v2.nn' has no ...
Read more >
module 'tensorflow_core._api.v2.nn' has no attribute 'rnn_cell ...
该问题是在tfv2环境下跑了tfv1的代码导致的,只需把v1的用法替换成v2留出的兼容用法即可: 用tf.compat.v1.nn.rnn_cell.RNNCell代替tf.nn.rnn_cell.R.
Read more >
[Tensorflow] module 'tensorflow_core._api' has no attribute 'v2'
Finally, I'm trying use tensorflow_core api. import tensorflow_core as tf_core tf_core._api.v2.saved_model.load('model/trt_int8', tags=[trt.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found