Type RNNCell
Namespace tensorflow.nn.rnn_cell
Parent Layer
Interfaces IRNNCell
Abstract object representing an RNN cell. Every `RNNCell` must have the properties below and implement `call` with
the signature `(output, next_state) = call(input, state)`. The optional
third input argument, `scope`, is allowed for backwards compatibility
purposes; but should be left off for new subclasses. This definition of cell differs from the definition used in the literature.
In the literature, 'cell' refers to an object with a single scalar output.
This definition refers to a horizontal array of such units. An RNN cell, in the most abstract setting, is anything that has
a state and performs some operation that takes a matrix of inputs.
This operation results in an output matrix with `self.output_size` columns.
If `self.state_size` is an integer, this operation also results in a new
state matrix with `self.state_size` columns. If `self.state_size` is a
(possibly nested tuple of) TensorShape object(s), then it should return a
matching structure of Tensors having shape `[batch_size].concatenate(s)`
for each `s` in `self.batch_size`.
Methods
- __call__
- __call__
- __call__
- __call__
- __call__
- __call__
- __call__
- __call__
- __call__
- __call__
- __call__
- __call__
- __call__
- __call__
- __call__
- __call__
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight
- add_weight_dyn
- NewDyn
Properties
- activity_regularizer
- activity_regularizer_dyn
- built
- dtype
- dtype_dyn
- dynamic
- dynamic_dyn
- graph
- graph_dyn
- inbound_nodes
- inbound_nodes_dyn
- input
- input_dyn
- input_mask
- input_mask_dyn
- input_shape
- input_shape_dyn
- input_spec
- input_spec_dyn
- losses
- losses_dyn
- metrics
- metrics_dyn
- name
- name_dyn
- name_scope
- name_scope_dyn
- non_trainable_variables
- non_trainable_variables_dyn
- non_trainable_weights
- non_trainable_weights_dyn
- outbound_nodes
- outbound_nodes_dyn
- output
- output_dyn
- output_mask
- output_mask_dyn
- output_shape
- output_shape_dyn
- output_size
- output_size_dyn
- PythonObject
- rnncell_scope
- scope_name
- scope_name_dyn
- state_size
- state_size_dyn
- stateful
- submodules
- submodules_dyn
- supports_masking
- trainable
- trainable_dyn
- trainable_variables
- trainable_variables_dyn
- trainable_weights
- trainable_weights_dyn
- updates
- updates_dyn
- variables
- variables_dyn
- weights
- weights_dyn
Public instance methods
object __call__(IEnumerable<IGraphNodeBase> inputs, IEnumerable<IGraphNodeBase> state, IDictionary<string, object> scope)
Run this RNN cell on inputs, starting from the given state.
Parameters
-
IEnumerable<IGraphNodeBase>
inputs - `2-D` tensor with shape `[batch_size, input_size]`.
-
IEnumerable<IGraphNodeBase>
state - if `self.state_size` is an integer, this should be a `2-D Tensor` with shape `[batch_size, self.state_size]`. Otherwise, if `self.state_size` is a tuple of integers, this should be a tuple with shapes `[batch_size, s] for s in self.state_size`.
-
IDictionary<string, object>
scope - VariableScope for the created subgraph; defaults to class name.
Returns
-
object
- A pair containing: - Output: A `2-D` tensor with shape `[batch_size, self.output_size]`. - New state: Either a single `2-D` tensor, or a tuple of tensors matching the arity and shapes of `state`.
object __call__(IGraphNodeBase inputs, object state, string scope)
Run this RNN cell on inputs, starting from the given state.
Parameters
-
IGraphNodeBase
inputs - `2-D` tensor with shape `[batch_size, input_size]`.
-
object
state - if `self.state_size` is an integer, this should be a `2-D Tensor` with shape `[batch_size, self.state_size]`. Otherwise, if `self.state_size` is a tuple of integers, this should be a tuple with shapes `[batch_size, s] for s in self.state_size`.
-
string
scope - VariableScope for the created subgraph; defaults to class name.
Returns
-
object
- A pair containing: - Output: A `2-D` tensor with shape `[batch_size, self.output_size]`. - New state: Either a single `2-D` tensor, or a tuple of tensors matching the arity and shapes of `state`.
object __call__(IGraphNodeBase inputs, object state, object scope)
Run this RNN cell on inputs, starting from the given state.
Parameters
-
IGraphNodeBase
inputs - `2-D` tensor with shape `[batch_size, input_size]`.
-
object
state - if `self.state_size` is an integer, this should be a `2-D Tensor` with shape `[batch_size, self.state_size]`. Otherwise, if `self.state_size` is a tuple of integers, this should be a tuple with shapes `[batch_size, s] for s in self.state_size`.
-
object
scope - VariableScope for the created subgraph; defaults to class name.
Returns
-
object
- A pair containing: - Output: A `2-D` tensor with shape `[batch_size, self.output_size]`. - New state: Either a single `2-D` tensor, or a tuple of tensors matching the arity and shapes of `state`.
object __call__(IGraphNodeBase inputs, object state, IEnumerable<IGraphNodeBase> scope)
Run this RNN cell on inputs, starting from the given state.
Parameters
-
IGraphNodeBase
inputs - `2-D` tensor with shape `[batch_size, input_size]`.
-
object
state - if `self.state_size` is an integer, this should be a `2-D Tensor` with shape `[batch_size, self.state_size]`. Otherwise, if `self.state_size` is a tuple of integers, this should be a tuple with shapes `[batch_size, s] for s in self.state_size`.
-
IEnumerable<IGraphNodeBase>
scope - VariableScope for the created subgraph; defaults to class name.
Returns
-
object
- A pair containing: - Output: A `2-D` tensor with shape `[batch_size, self.output_size]`. - New state: Either a single `2-D` tensor, or a tuple of tensors matching the arity and shapes of `state`.
object __call__(IGraphNodeBase inputs, IEnumerable<IGraphNodeBase> state, string scope)
Run this RNN cell on inputs, starting from the given state.
Parameters
-
IGraphNodeBase
inputs - `2-D` tensor with shape `[batch_size, input_size]`.
-
IEnumerable<IGraphNodeBase>
state - if `self.state_size` is an integer, this should be a `2-D Tensor` with shape `[batch_size, self.state_size]`. Otherwise, if `self.state_size` is a tuple of integers, this should be a tuple with shapes `[batch_size, s] for s in self.state_size`.
-
string
scope - VariableScope for the created subgraph; defaults to class name.
Returns
-
object
- A pair containing: - Output: A `2-D` tensor with shape `[batch_size, self.output_size]`. - New state: Either a single `2-D` tensor, or a tuple of tensors matching the arity and shapes of `state`.
object __call__(IGraphNodeBase inputs, IEnumerable<IGraphNodeBase> state, object scope)
Run this RNN cell on inputs, starting from the given state.
Parameters
-
IGraphNodeBase
inputs - `2-D` tensor with shape `[batch_size, input_size]`.
-
IEnumerable<IGraphNodeBase>
state - if `self.state_size` is an integer, this should be a `2-D Tensor` with shape `[batch_size, self.state_size]`. Otherwise, if `self.state_size` is a tuple of integers, this should be a tuple with shapes `[batch_size, s] for s in self.state_size`.
-
object
scope - VariableScope for the created subgraph; defaults to class name.
Returns
-
object
- A pair containing: - Output: A `2-D` tensor with shape `[batch_size, self.output_size]`. - New state: Either a single `2-D` tensor, or a tuple of tensors matching the arity and shapes of `state`.
object __call__(IGraphNodeBase inputs, IEnumerable<IGraphNodeBase> state, IEnumerable<IGraphNodeBase> scope)
Run this RNN cell on inputs, starting from the given state.
Parameters
-
IGraphNodeBase
inputs - `2-D` tensor with shape `[batch_size, input_size]`.
-
IEnumerable<IGraphNodeBase>
state - if `self.state_size` is an integer, this should be a `2-D Tensor` with shape `[batch_size, self.state_size]`. Otherwise, if `self.state_size` is a tuple of integers, this should be a tuple with shapes `[batch_size, s] for s in self.state_size`.
-
IEnumerable<IGraphNodeBase>
scope - VariableScope for the created subgraph; defaults to class name.
Returns
-
object
- A pair containing: - Output: A `2-D` tensor with shape `[batch_size, self.output_size]`. - New state: Either a single `2-D` tensor, or a tuple of tensors matching the arity and shapes of `state`.
object __call__(IGraphNodeBase inputs, IEnumerable<IGraphNodeBase> state, IDictionary<string, object> scope)
Run this RNN cell on inputs, starting from the given state.
Parameters
-
IGraphNodeBase
inputs - `2-D` tensor with shape `[batch_size, input_size]`.
-
IEnumerable<IGraphNodeBase>
state - if `self.state_size` is an integer, this should be a `2-D Tensor` with shape `[batch_size, self.state_size]`. Otherwise, if `self.state_size` is a tuple of integers, this should be a tuple with shapes `[batch_size, s] for s in self.state_size`.
-
IDictionary<string, object>
scope - VariableScope for the created subgraph; defaults to class name.
Returns
-
object
- A pair containing: - Output: A `2-D` tensor with shape `[batch_size, self.output_size]`. - New state: Either a single `2-D` tensor, or a tuple of tensors matching the arity and shapes of `state`.
object __call__(IGraphNodeBase inputs, object state, IDictionary<string, object> scope)
Run this RNN cell on inputs, starting from the given state.
Parameters
-
IGraphNodeBase
inputs - `2-D` tensor with shape `[batch_size, input_size]`.
-
object
state - if `self.state_size` is an integer, this should be a `2-D Tensor` with shape `[batch_size, self.state_size]`. Otherwise, if `self.state_size` is a tuple of integers, this should be a tuple with shapes `[batch_size, s] for s in self.state_size`.
-
IDictionary<string, object>
scope - VariableScope for the created subgraph; defaults to class name.
Returns
-
object
- A pair containing: - Output: A `2-D` tensor with shape `[batch_size, self.output_size]`. - New state: Either a single `2-D` tensor, or a tuple of tensors matching the arity and shapes of `state`.
object __call__(IEnumerable<IGraphNodeBase> inputs, object state, object scope)
Run this RNN cell on inputs, starting from the given state.
Parameters
-
IEnumerable<IGraphNodeBase>
inputs - `2-D` tensor with shape `[batch_size, input_size]`.
-
object
state - if `self.state_size` is an integer, this should be a `2-D Tensor` with shape `[batch_size, self.state_size]`. Otherwise, if `self.state_size` is a tuple of integers, this should be a tuple with shapes `[batch_size, s] for s in self.state_size`.
-
object
scope - VariableScope for the created subgraph; defaults to class name.
Returns
-
object
- A pair containing: - Output: A `2-D` tensor with shape `[batch_size, self.output_size]`. - New state: Either a single `2-D` tensor, or a tuple of tensors matching the arity and shapes of `state`.
object __call__(IEnumerable<IGraphNodeBase> inputs, object state, IEnumerable<IGraphNodeBase> scope)
Run this RNN cell on inputs, starting from the given state.
Parameters
-
IEnumerable<IGraphNodeBase>
inputs - `2-D` tensor with shape `[batch_size, input_size]`.
-
object
state - if `self.state_size` is an integer, this should be a `2-D Tensor` with shape `[batch_size, self.state_size]`. Otherwise, if `self.state_size` is a tuple of integers, this should be a tuple with shapes `[batch_size, s] for s in self.state_size`.
-
IEnumerable<IGraphNodeBase>
scope - VariableScope for the created subgraph; defaults to class name.
Returns
-
object
- A pair containing: - Output: A `2-D` tensor with shape `[batch_size, self.output_size]`. - New state: Either a single `2-D` tensor, or a tuple of tensors matching the arity and shapes of `state`.
object __call__(IEnumerable<IGraphNodeBase> inputs, object state, IDictionary<string, object> scope)
Run this RNN cell on inputs, starting from the given state.
Parameters
-
IEnumerable<IGraphNodeBase>
inputs - `2-D` tensor with shape `[batch_size, input_size]`.
-
object
state - if `self.state_size` is an integer, this should be a `2-D Tensor` with shape `[batch_size, self.state_size]`. Otherwise, if `self.state_size` is a tuple of integers, this should be a tuple with shapes `[batch_size, s] for s in self.state_size`.
-
IDictionary<string, object>
scope - VariableScope for the created subgraph; defaults to class name.
Returns
-
object
- A pair containing: - Output: A `2-D` tensor with shape `[batch_size, self.output_size]`. - New state: Either a single `2-D` tensor, or a tuple of tensors matching the arity and shapes of `state`.
object __call__(IEnumerable<IGraphNodeBase> inputs, IEnumerable<IGraphNodeBase> state, string scope)
Run this RNN cell on inputs, starting from the given state.
Parameters
-
IEnumerable<IGraphNodeBase>
inputs - `2-D` tensor with shape `[batch_size, input_size]`.
-
IEnumerable<IGraphNodeBase>
state - if `self.state_size` is an integer, this should be a `2-D Tensor` with shape `[batch_size, self.state_size]`. Otherwise, if `self.state_size` is a tuple of integers, this should be a tuple with shapes `[batch_size, s] for s in self.state_size`.
-
string
scope - VariableScope for the created subgraph; defaults to class name.
Returns
-
object
- A pair containing: - Output: A `2-D` tensor with shape `[batch_size, self.output_size]`. - New state: Either a single `2-D` tensor, or a tuple of tensors matching the arity and shapes of `state`.
object __call__(IEnumerable<IGraphNodeBase> inputs, IEnumerable<IGraphNodeBase> state, object scope)
Run this RNN cell on inputs, starting from the given state.
Parameters
-
IEnumerable<IGraphNodeBase>
inputs - `2-D` tensor with shape `[batch_size, input_size]`.
-
IEnumerable<IGraphNodeBase>
state - if `self.state_size` is an integer, this should be a `2-D Tensor` with shape `[batch_size, self.state_size]`. Otherwise, if `self.state_size` is a tuple of integers, this should be a tuple with shapes `[batch_size, s] for s in self.state_size`.
-
object
scope - VariableScope for the created subgraph; defaults to class name.
Returns
-
object
- A pair containing: - Output: A `2-D` tensor with shape `[batch_size, self.output_size]`. - New state: Either a single `2-D` tensor, or a tuple of tensors matching the arity and shapes of `state`.
object __call__(IEnumerable<IGraphNodeBase> inputs, IEnumerable<IGraphNodeBase> state, IEnumerable<IGraphNodeBase> scope)
Run this RNN cell on inputs, starting from the given state.
Parameters
-
IEnumerable<IGraphNodeBase>
inputs - `2-D` tensor with shape `[batch_size, input_size]`.
-
IEnumerable<IGraphNodeBase>
state - if `self.state_size` is an integer, this should be a `2-D Tensor` with shape `[batch_size, self.state_size]`. Otherwise, if `self.state_size` is a tuple of integers, this should be a tuple with shapes `[batch_size, s] for s in self.state_size`.
-
IEnumerable<IGraphNodeBase>
scope - VariableScope for the created subgraph; defaults to class name.
Returns
-
object
- A pair containing: - Output: A `2-D` tensor with shape `[batch_size, self.output_size]`. - New state: Either a single `2-D` tensor, or a tuple of tensors matching the arity and shapes of `state`.
object __call__(IEnumerable<IGraphNodeBase> inputs, object state, string scope)
Run this RNN cell on inputs, starting from the given state.
Parameters
-
IEnumerable<IGraphNodeBase>
inputs - `2-D` tensor with shape `[batch_size, input_size]`.
-
object
state - if `self.state_size` is an integer, this should be a `2-D Tensor` with shape `[batch_size, self.state_size]`. Otherwise, if `self.state_size` is a tuple of integers, this should be a tuple with shapes `[batch_size, s] for s in self.state_size`.
-
string
scope - VariableScope for the created subgraph; defaults to class name.
Returns
-
object
- A pair containing: - Output: A `2-D` tensor with shape `[batch_size, self.output_size]`. - New state: Either a single `2-D` tensor, or a tuple of tensors matching the arity and shapes of `state`.
object add_weight(string name, Dimension shape, DType dtype, object initializer, object regularizer, object trainable, object constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, TensorShape shape, DType dtype, PythonFunctionContainer initializer, object regularizer, object trainable, IDictionary<object, object> constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, TensorShape shape, DType dtype, PythonFunctionContainer initializer, object regularizer, object trainable, object constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, TensorShape shape, DType dtype, object initializer, object regularizer, object trainable, IDictionary<object, object> constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, int shape, DType dtype, PythonFunctionContainer initializer, object regularizer, object trainable, object constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, int shape, DType dtype, PythonFunctionContainer initializer, object regularizer, object trainable, IDictionary<object, object> constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, int shape, DType dtype, object initializer, object regularizer, object trainable, IDictionary<object, object> constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, Dimension shape, DType dtype, object initializer, object regularizer, object trainable, IDictionary<object, object> constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, TensorShape shape, DType dtype, object initializer, object regularizer, object trainable, object constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, Dimension shape, DType dtype, PythonFunctionContainer initializer, object regularizer, object trainable, object constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, IEnumerable<object> shape, DType dtype, PythonFunctionContainer initializer, object regularizer, object trainable, object constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, ValueTuple shape, DType dtype, object initializer, object regularizer, object trainable, object constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, ValueTuple shape, DType dtype, object initializer, object regularizer, object trainable, IDictionary<object, object> constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, ValueTuple shape, DType dtype, PythonFunctionContainer initializer, object regularizer, object trainable, object constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, ValueTuple shape, DType dtype, PythonFunctionContainer initializer, object regularizer, object trainable, IDictionary<object, object> constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, IEnumerable<object> shape, DType dtype, object initializer, object regularizer, object trainable, object constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, IEnumerable<object> shape, DType dtype, object initializer, object regularizer, object trainable, IDictionary<object, object> constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, int shape, DType dtype, object initializer, object regularizer, object trainable, object constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, IEnumerable<object> shape, DType dtype, PythonFunctionContainer initializer, object regularizer, object trainable, IDictionary<object, object> constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight(string name, Dimension shape, DType dtype, PythonFunctionContainer initializer, object regularizer, object trainable, IDictionary<object, object> constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
object add_weight_dyn(object name, object shape, object dtype, object initializer, object regularizer, object trainable, object constraint, object use_resource, ImplicitContainer<T> synchronization, ImplicitContainer<T> aggregation, object partitioner, IDictionary<string, object> kwargs)
Public static methods
RNNCell NewDyn(ImplicitContainer<T> trainable, object name, object dtype, IDictionary<string, object> kwargs)
Public properties
PythonFunctionContainer activity_regularizer get; set;
object activity_regularizer_dyn get; set;
bool built get; set;
object dtype get;
object dtype_dyn get;
bool dynamic get;
object dynamic_dyn get;
object graph get;
object graph_dyn get;
IList<Node> inbound_nodes get;
object inbound_nodes_dyn get;
IList<object> input get;
object input_dyn get;
object input_mask get;
object input_mask_dyn get;
IList<object> input_shape get;
object input_shape_dyn get;
object input_spec get; set;
object input_spec_dyn get; set;
IList<object> losses get;
object losses_dyn get;
IList<object> metrics get;
object metrics_dyn get;
object name get;
object name_dyn get;
object name_scope get;
object name_scope_dyn get;
IList<object> non_trainable_variables get;
object non_trainable_variables_dyn get;
IList<object> non_trainable_weights get;
object non_trainable_weights_dyn get;
IList<object> outbound_nodes get;
object outbound_nodes_dyn get;
IList<object> output get;
object output_dyn get;
object output_mask get;
object output_mask_dyn get;
object output_shape get;
object output_shape_dyn get;
object output_size get;
Integer or TensorShape: size of outputs produced by this cell.
object output_size_dyn get;
Integer or TensorShape: size of outputs produced by this cell.
object PythonObject get;
object rnncell_scope get; set;
string scope_name get;
object scope_name_dyn get;
object state_size get;
size(s) of state(s) used by this cell. It can be represented by an Integer, a TensorShape or a tuple of Integers
or TensorShapes.
object state_size_dyn get;
size(s) of state(s) used by this cell. It can be represented by an Integer, a TensorShape or a tuple of Integers
or TensorShapes.