Dense layers

Dense or fully connected layer

Dense Fully connected or dense layer
class braid.berry.layers.Dense(incoming, num_units, activation='linear', init=None, W_stddev=0.001, b_val=0.1, **kwargs)

Fully connected or dense layer

incoming
: Layer or tf.Tensor
Parent layer, whose output is given as input to the current layer.
num_units
: int
The number of hidden units.
activation
: string, optional (default = “linear”)
Nonlinearity to apply afer performing convolution. See berry.activations
init
: string, optional (default = None)
Weight initialization method to choose. See berry.initializations
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 (inherited from Layer).
b
: tf.Variable, optional (default = None)
Bias vector (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_W_shape()

Shape of the weight tensor

list
[input_channels, num_units]
get_b_shape()

Number of bias units

list
[num_units]
get_fan_in()

Input receptive field

int
input_channels
get_fan_out()

Output receptive field

int
num_units
get_output_for()

Perform the matrix product, add the bias, apply the activation function and return the output tf.Tensor

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

Shape of the output tensor

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

Validate the input layer shape

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