[Solved]: AttributeError: module 'tensorflow.contrib.rnn.python.ops.rnn_cell' has no attribute 'RNNCell'

ERROR:

These are my imports:

import tensorflow as tffrom tensorflow.contrib.rnn.python.ops import rnn_cellfrom tensorflow.python.ops import nn_opsfrom tensorflow.python.ops import variable_scope as vsfrom tensorflow.python.framework import opsfrom tensorflow.contrib import rnnfrom tensorflow.python.util.nest import flattenimport numpy as npThis is code for input:
class PartitionedMultiRNNCell(rnn_cell.RNNCell):

I am getting the following error :

AttributeError: module 'tensorflow.contrib.rnn.python.ops.rnn_cell' has no attribute 'RNNCell'

Solution:

The API for Tensorflow has changed in more recent versions. To fix this, edit src/model/seq2seq.py by

  1. Changing rnn_cell.RNNCell to  core_rnn_cell.RNNCell
  2. Including the import from tensorflow.contrib.rnn.python.ops import core_rnn_cell

Hope that helps!