def __init__(self, cell, function, reuse=None):
if not isinstance(cell, tf.contrib.rnn.RNNCell):
raise TypeError('The parameter cell is not an RNNCell.')
if isinstance(function, six.string_types):
try:
function = getattr(tf, function)
except AttributeError:
try:
function = getattr(tf.nn, function)
except AttributeError:
raise ValueError('The desired function "%s" was '
'not found.' % function)
self._cell = cell
self._function = function
评论列表
文章目录