Recurrent layers

Recurrent layers

RNN RNN layer
class braid.berry.layers.RNN(incoming, num_units, num_of_cells, cell_type='LSTM', return_cell_out=False, use_peepholes=False, cell_clip=None, pad='VALID', activation=None, init=None, W_stddev=0.01, b_val=0.1, **kwargs)

RNN layer

incoming
: Layer or tf.Tensor
Parent layer, whose output is given as input to the current layer.
num_units
: int
The number of output units.
num_of_cells
: int
The number of cells/steps in the layer.
cell_type
: string, optional (default = “LSTM”)
Type of recurrent cell to be used.
activation
: string, optional (default = “linear”)
Nonlinearity to apply afer performing convolution. See berry.activations
return_cell_out
: bool, optional (default = False)
If true output from all cells are returned as 3d tensor, otherwise just final output as 2d tensor.
W_stddev
: float, optional (default = 1e-2)
Standard deviation for Normal distribution to initialize the weights, if init = None.
b_val
: float, optional (default = 0.1)
Constant value to initialize the biases.
W
: tf.Variable, optional (default = None)
Weight tensor in case if the layer has any trainable parameters (inherited from Layer).
b
: tf.Variable, optional (default = None)
Bias vector in case of trainable parameters (inherited from Layer).
name
: string, optional (default = None)
Name of the layer. Should be specified for better readability ( inherited from Layer).
input_layer
: Layer or tf.Tensor
Input layer to this layer.
input_shape
: tuple
Shape of the incoming layer.
output
: tf.Tensor
The Tensor obtained after performing the transformation applied by this layer.
output_shape
: tuple
Shape of the output tensor.
type
: string
Return the name of the class.

See also

Inherits class Layer.

get_output_for()

Perform the convolution operation, activation and return the output tf.Tensor.

tf.Tensor
Output tensor of this layer.
get_output_shape_for(input_shape)

Shape of the output tensor after performing convolution.

input_shape
: tuple or list
Shape of the input layer.
tuple
Shape of the output tensor.
validate_input_layer(incoming)

Validate the input layer shape

Returns True if the input layer is 4D else, raise an exceptions.AssertError.