本文整理匯總了Python中tensorflow.python.ops.rnn_cell_impl._RNNCell方法的典型用法代碼示例。如果您正苦於以下問題:Python rnn_cell_impl._RNNCell方法的具體用法?Python rnn_cell_impl._RNNCell怎麽用?Python rnn_cell_impl._RNNCell使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tensorflow.python.ops.rnn_cell_impl
的用法示例。
在下文中一共展示了rnn_cell_impl._RNNCell方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from tensorflow.python.ops import rnn_cell_impl [as 別名]
# 或者: from tensorflow.python.ops.rnn_cell_impl import _RNNCell [as 別名]
def __init__(self, cell, output_size):
"""Create a cell with output projection.
Args:
cell: an RNNCell, a projection to output_size is added to it.
output_size: integer, the size of the output after projection.
Raises:
TypeError: if cell is not an RNNCell.
ValueError: if output_size is not positive.
"""
if not isinstance(cell, RNNCell):
raise TypeError("The parameter cell is not RNNCell.")
if output_size < 1:
raise ValueError("Parameter output_size must be > 0: %d." % output_size)
self._cell = cell
self._output_size = output_size
示例2: __init__
# 需要導入模塊: from tensorflow.python.ops import rnn_cell_impl [as 別名]
# 或者: from tensorflow.python.ops.rnn_cell_impl import _RNNCell [as 別名]
def __init__(self, cell, zoneout_prob, is_training=True, seed=None):
if not isinstance(cell, RNNCell):
raise TypeError("The parameter cell is not an RNNCell.")
if (isinstance(zoneout_prob, float) and
not (zoneout_prob >= 0.0 and zoneout_prob <= 1.0)):
raise ValueError("Parameter zoneout_prob must be between 0 and 1: %d"
% zoneout_prob)
self._cell = cell
self._zoneout_prob = zoneout_prob
self._seed = seed
self.is_training = tf.convert_to_tensor(is_training)