Previous topic

nnet – Ops related to neural networks

Next topic

nnet – Ops for neural networks

This Page

conv – Ops for convolutional neural nets

Note

Two similar implementation exists for conv2d: theano.tensor.signal.conv.conv2d and theano.tensor.nnet.conv.conv2d. The foremer implements a traditional 2D convolution, while the latter implements the convolutional layers present in convolutional neural networks (where filters are 3D and pool over several input channels).

Platforms: Unix, Windows

TODO: Give examples for how to use these things! They are pretty complicated.

theano.tensor.nnet.conv.conv2d(input, filters, image_shape=None, filter_shape=None, border_mode='valid', subsample=(1, 1), **kargs)

This function will build the symbolic graph for convolving a stack of input images with a set of filters. The implementation is modelled after Convolutional Neural Networks (CNN). It is simply a wrapper to the ConvOp but provides a much cleaner interface.

Parameters:
  • input (symbolic 4D tensor) – mini-batch of feature map stacks, of shape image_shape.
  • filters (symbolic 4D tensor) – set of filters used in CNN layer of shape filter_shape
  • border_mode
    ‘valid’– only apply filter to complete patches of the image. Generates
    output of shape: image_shape - filter_shape + 1
    ‘full’ – zero-pads image to multiple of filter shape to generate output of
    shape: image_shape + filter_shape - 1
  • subsample (tuple of len 2) – factor by which to subsample the output
  • image_shape (tuple of len 4) – (batch size, stack size, nb row, nb col)
  • filter_shape (tuple of len 4) – (nb filters, stack size, nb row, nb col)
  • kwargs – kwargs are passed onto ConvOp. Can be used to set the following: unroll_batch, unroll_kern, unroll_patch (see ConvOp doc)
Return type:

symbolic 4D tensor

Returns:

set of feature maps generated by convolutional layer. Tensor is of shape (batch size, nb filters, output row, output col)