network.py
The main function for defining the optimizer network.
-
class StandardDeepLSTM(Network)
- Standard LSTM layers with a Linear layer on top.
-
Arguments:
output_size
: Output sizes of the final linear layer.layers
: Output sizes of LSTM layers.preprocess_name
: Gradient preprocessing class name (inl2l.preprocess
or tf modules). Default istf.identity
.preprocess_options
: Gradient preprocessing options.scale
: Gradient scaling (default is 1.0).initializer
: Variable initializer for linear layer. Seesnt.Linear
andsnt.LSTM
docs for more info. This parameter can be a string (e.g. "zeros" will be converted to tf.zeros_initializer). name: Module name.
-
Arributes:
-
_build(self, inputs, prev_state):
-
Connects the
StandardDeepLSTM
module into the graph. -
Arguments:
inputs
: 2DTensor
([batch_size, input_size]).prev_state
:DeepRNN
state.
-
Return:
Tensor
shaped asinputs
.
-
-
class CoordinateWiseDeepLSTM(StandardDeepLSTM)
-
Coordinate-wise LSTM that is used in this study.
-
Arguments:
output_size
: Output sizes of the final linear layer.layers
: Output sizes of LSTM layers.preprocess_name
: Gradient preprocessing class name (inl2l.preprocess
or tf modules). Default istf.identity
.preprocess_options
: Gradient preprocessing options.scale
: Gradient scaling (default is 1.0).initializer
: Variable initializer for linear layer. Seesnt.Linear
andsnt.LSTM
docs for more info. This parameter can be a string (e.g. "zeros" will be converted to tf.zeros_initializer). name: Module name.
-
Arributes:
-
_build(self, inputs, prev_state):
-
Connects the CoordinateWiseDeepLSTM module into the graph.
-
Arguments:
inputs
: Arbitrarily shapedTensor
.prev_state
:DeepRNN
state.
-
Return :
Tensor
shaped asinputs
.
-
-