theanets.layers.convolution.Conv2

class theanets.layers.convolution.Conv2(filter_size, stride=(1, 1), border_mode='valid', **kwargs)[source]

2-dimensional convolutions run over two data axes.

Two-dimensional convolution layers are standard image processing techniques. In theanets, these layers expect an input consisting of (num-examples, width, height, num-channels).

Parameters:
filter_size : (int, int)

Size of the convolution filters for this layer.

stride : (int, int), optional

Apply convolutions with this stride; i.e., skip this many samples between convolutions. Defaults to (1, 1), i.e., no skipping.

border_mode : str, optional

Compute convolutions with this border mode. Defaults to ‘valid’.

__init__(filter_size, stride=(1, 1), border_mode='valid', **kwargs)

x.__init__(…) initializes x; see help(type(x)) for signature

Methods

__init__(filter_size[, stride, border_mode]) x.__init__(…) initializes x; see help(type(x)) for signature
add_bias(name, size[, mean, std]) Helper method to create a new bias vector.
add_conv_weights(name[, mean, std, sparsity]) Add a convolutional weight array to this layer’s parameters.
add_weights(name, nin, nout[, mean, std, …]) Helper method to create a new weight matrix.
bind(graph[, reset, initialize]) Bind this layer into a computation graph.
connect(inputs) Create Theano variables representing the outputs of this layer.
find(key) Get a shared variable for a parameter by name.
full_name(name) Return a fully-scoped name for the given layer output.
log() Log some information about this layer.
log_params() Log information about this layer’s parameters.
resolve_inputs(layers) Resolve the names of inputs for this layer into shape tuples.
resolve_outputs() Resolve the names of outputs for this layer into shape tuples.
setup() Set up the parameters and initial values for this layer.
to_spec() Create a specification dictionary for this layer.
transform(inputs) Transform the inputs for this layer into an output for the layer.

Attributes

input_name Name of layer input (for layers with one input).
input_shape Shape of layer input (for layers with one input).
input_size Size of layer input (for layers with one input).
output_name Full name of the default output for this layer.
output_shape Shape of default output from this layer.
output_size Number of “neurons” in this layer’s default output.
params A list of all parameters in this layer.
resolve_outputs()[source]

Resolve the names of outputs for this layer into shape tuples.

setup()[source]

Set up the parameters and initial values for this layer.

transform(inputs)[source]

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.