AttributeError: module 'tensorflow.python.ops.rnn_cell_impl' has no attribute '_linear'

Viewed 340

Using anaconda, I had installed python 3.8 and tensorflow 2.5.0 to run the package called DeepNovo.

But DeepNovo requires python 2.7 / tensorflow 1.2 setting so I'm trying to convert the codes appropriate for lower versions.

Then I got following error when I tried to run this code:

File "/Data2/HJE/DeepNovo/deepnovo_model.py", line 442, in _build_cnn_ion cnn_ion_logit = rnn_cell_impl._linear(args=cnn_ion_feature, AttributeError: module 'tensorflow.python.ops.rnn_cell_impl' has no attribute '_linear'

It seems like "_linear" function is not available for tensorflow 2.x version. Is there any compatible code for tensorflow 2.X version?

1 Answers

Use with Tensorflow 1.x

from tensorflow.contrib.rnn.python.ops.rnn_cell import _Linear

or

from tensorflow.contrib.rnn.python.ops import core_rnn_cell
linear = core_rnn_cell._linear
Related