cns_mapdim

For dimensions of a layer that are mapped to a common coordinate space, this is the main function used to determine layer size and assign common coordinates along those dimensions. This can be done in many different ways.

Syntax

m = cns_mapdim(m, z, dim, mode, mode-specific-args)
m
A model structure.

z
The layer number for which we are determining the size and common coordinates (along some dimension).

dim
The name or number of the dimension (of layer z) for which we are determining the size and common coordinates.

mode
Identifies the particular method we will use; see the table below.

mode-specific-args
Additional arguments depending on the mode; see the table below.
Mode Description and Additional Arguments
'pixels' Sets the dimension size to an arbitrary number, and assigns common coordinates so that the cells (pixels) fill the interval [0, 1]. The only additional argument is:
size
size
A positive integer.
'scaledpixels' This is similar to 'pixels' except that the dimension size is given as a scaled-down version of a base size. If the base size is odd, the resulting dimension size is guaranteed to be odd, no matter what the scale factor. Similarly, an even base size will always result in an even dimension size. All this is done so that multiple layers which represent different rescalings of an image will all have the same form -- either they will all have a central cell, or none will. The additional arguments are:
baseSize, factor
baseSize
A positive integer.
factor
The scale factor. A floating-point number greater than or equal to 1.
'copy' Copies settings for this dimension from another layer. Layer z will have the same number of cells, at the same common coordinate positions, as layer pz. The only additional argument is:
pz
pz
The layer number to copy settings from.
'int' Sets up layer z as the result of a valid "convolution" of another layer pz with a filter. (It's not strictly convolution because the filter can move across layer pz in steps of 1 or greater. This is illustrated nicely here.) Ensures that the resulting layer z will always be symmetric about the center -- any losses at the edges will be the same at both edges. The additional arguments are:
pz, rfSize, rfStep, rfMargin, parity
pz
The layer number which is the input to the convolution.
rfSize
The size of the filter (a positive integer). Can also be inf, indicating that the filter represents a global pooling operation -- in this case the resulting layer z will have size 1.
rfStep
The step size with which the filter moves across layer pz. A positive integer. Ignored if rfSize is inf.
rfMargin
Defaults to 0. A positive (integer) value tells cns_mapdim to ignore that many units at either edge of layer pz. A negative (integer) value allows the convolution to go "over the edge" by that many units. Ignored if rfSize is inf.
parity
There are two ways the resulting layer can be symmetric about the center: it can have a single unit in the center, or two units equally far from the center on opposite sides. Sometimes only one of these is possible. When both are possible, this optional parameter controls the decision.
  • 1 - odd parity. Place a unit in the center.
  • 0 - even parity. Place two units equally far from the center on opposite sides.
  • [] - maximize the number of units in the resulting layer. (The default.)
'int-td' This is the top-down version of 'int'. Here, layer pz is treated as the result of the convolution, and we're setting up layer z so that it will be large enough to produce layer pz as a result. The additional arguments are:
pz, rfSize, rfStep
pz
The layer number which is the output of the convolution.
rfSize
The size of the filter (a positive integer). Cannot be inf.
rfStep
The step size with which the filter moves across layer z. A positive integer.
'win' TODO. The additional arguments are:
pz, rfSize, rfStep, rfMargin, parity
pz
TODO.
rfSize
TODO. A positive floating-point number. Can be inf.
rfStep
TODO. A positive floating-point number.
rfMargin
TODO. Any positive or negative floating-point number.
parity
TODO.