theanets.layers.base.Input

class theanets.layers.base.Input(size, name='in', ndim=2, sparse=False)

A layer that receives external input data.

Input layers are responsible for the Theano variables that represent input to a network. The name of the layer is passed along to the symbolic Theano input variable.

Input layers essentially add only noise to the input data (if desired), but otherwise reproduce their inputs exactly.

Parameters:

ndim : int, optional

Number of dimensions required to store the input data for this layer. Defaults to 2: (num-examples, num-variables).

sparse : bool or str, optional

If this is 'csr' or 'csc', then the inputs to the loss will be stored as sparse matrices in the CSR or CSC format (respectively). If this is True, sparse input will be enabled in CSR format. By default this is False, which means inputs are dense.

Raises:

AssertionError :

If sparse is enabled and ndim is not 2.

__init__(size, name='in', ndim=2, sparse=False)

Methods

__init__(size[, name, ndim, sparse])
add_bias(name, size[, mean, std]) Helper method to create a new bias vector.
add_weights(name, nin, nout[, mean, std, ...]) Helper method to create a new weight matrix.
connect(inputs) Create Theano variables representing the outputs of this layer.
find(key) Get a shared variable for a parameter by name.
log() Log some information about this layer.
output_name([name]) Return a fully-scoped name for the given layer output.
setup() Set up the parameters and initial values for this layer.
to_spec() Create a specification for this layer.
transform(inputs) Transform the inputs for this layer into an output for the layer.

Attributes

input_size For networks with one input, get the input size.
num_params Total number of learnable parameters in this layer.
params A list of all parameters in this layer.
log()

Log some information about this layer.

to_spec()

Create a specification for this layer.

Returns:

spec : int

A single integer specifying the size of this layer.

transform(inputs)

Transform the inputs for this layer into an output for the layer.

Parameters:

inputs : dict of Theano expressions

Symbolic inputs to this layer, given as a dictionary mapping string names to Theano expressions. See Layer.connect().

Returns:

output : Theano expression

The output for this layer is the same as the input.

updates : list

An empty updates list.