On this page
tf.compat.v1.nn.rnn_cell.ResidualWrapper
RNNCell wrapper that ensures cell inputs are added to the outputs.
Inherits From: RNNCell
, Layer
, Layer
, Module
tf.compat.v1.nn.rnn_cell.ResidualWrapper(
cell, residual_fn=None, **kwargs
)
Args | |
---|---|
cell |
An instance of RNNCell . |
residual_fn |
(Optional) The function to map raw cell inputs and raw cell outputs to the actual cell outputs of the residual network. Defaults to calling nest.map_structure on (lambda i, o: i + o), inputs and outputs. |
**kwargs |
dict of keyword arguments for base layer. |
Attributes | |
---|---|
graph |
|
output_size |
Integer or TensorShape: size of outputs produced by this cell. |
scope_name |
|
state_size |
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. |
Methods
apply
apply(
*args, **kwargs
)
get_initial_state
get_initial_state(
inputs=None, batch_size=None, dtype=None
)
get_losses_for
get_losses_for(
inputs
)
Retrieves losses relevant to a specific set of inputs.
Args | |
---|---|
inputs |
Input tensor or list/tuple of input tensors. |
Returns | |
---|---|
List of loss tensors of the layer that depend on inputs . |
get_updates_for
get_updates_for(
inputs
)
Retrieves updates relevant to a specific set of inputs.
Args | |
---|---|
inputs |
Input tensor or list/tuple of input tensors. |
Returns | |
---|---|
List of update ops of the layer that depend on inputs . |
zero_state
zero_state(
batch_size, dtype
)
Return zero-filled state tensor(s).
Args | |
---|---|
batch_size |
int, float, or unit Tensor representing the batch size. |
dtype |
the data type to use for the state. |
Returns | |
---|---|
If state_size is an int or TensorShape, then the return value is a N-D tensor of shape [batch_size, state_size] filled with zeros. If |
© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/compat/v1/nn/rnn_cell/ResidualWrapper