Package

toolkit.neuralnetwork

function

Permalink

package function

Visibility
  1. Public
  2. All

Type Members

  1. case class AplusBXtoN(input: DifferentiableField, a: Float, b: Float, n: Float) extends DifferentiableField with Product with Serializable

    Permalink

    Function that takes an input X and outputs (A + B*X)^N. Cog has two pow() function signatures corresponding to both integer and non-integer powers. The integer case for N is detected here and special-cased (instead of having a separate node for this).

    Function that takes an input X and outputs (A + B*X)^N. Cog has two pow() function signatures corresponding to both integer and non-integer powers. The integer case for N is detected here and special-cased (instead of having a separate node for this).

    If N is other than a positive integer, be aware that you may need to ensure that the A + B*X term is always positive to avoid NaNs from killing the model state.

    input

    the input signal

    a

    a constant offset added to the input

    b

    a constant multiplier that scales the input

    n

    the power to raise the input to

  2. trait BasicOps extends AnyRef

    Permalink
  3. case class Bias(input: DifferentiableField, weights: DifferentiableField, sharedBias: Boolean = false) extends DifferentiableField with Product with Serializable

    Permalink

    A bias transformation that adds bias weights to the input signal

    A bias transformation that adds bias weights to the input signal

    input

    The input signal

    weights

    The bias weights

    sharedBias

    Flag for sharing bias across the input field. Sharing bias causes the bias to be applied uniformly across the field points of the input and requires that weights has a 0D field shape. Unshared bias applies a different bias to each field point and requires weights to have the same field shape as input.

  4. case class CrossEntropy(left: DifferentiableField, right: DifferentiableField) extends DifferentiableField with Product with Serializable

    Permalink

    The cross-entropy loss function applied to the softmax of the input relative to the reference signal.

    The cross-entropy loss function applied to the softmax of the input relative to the reference signal. This loss function is commonly used for training a classification network.

    left

    The input signal, typically a classification output

    right

    The reference signal, typically a one hot code representing a class label

  5. case class CrossEntropySoftmax(inference: DifferentiableField, labels: DifferentiableField) extends DifferentiableField with Product with Serializable

    Permalink
  6. case class CrossEntropySoftmaxes(left: DifferentiableField, right: DifferentiableField, refInputIsPDF: Boolean = true, safeMode: Boolean = true) extends DifferentiableField with Product with Serializable

    Permalink

    The cross-entropy loss function applied to the softmax of the input relative to the reference signal.

    The cross-entropy loss function applied to the softmax of the input relative to the reference signal. This loss function is commonly used for training a classification network. Unlike the similarly-named "CrossEntropySoftMax", this class computes a cross-entropy softmax individually for each image representation of the batch. As such, its output is not a single scalar, but instead a vector of length batchSize. This allows the class to be tested by the existing test infrastructure.

    left

    The input signal, typically a classification output

    right

    The reference signal, typically a one hot code representing a class label

    refInputIsPDF

    The right reference input for each element of the batch sums to 1.

    safeMode

    Protect against generating NaNs for large inputs (>100).

  7. case class Downsample(input: DifferentiableField, factor: Int = 2) extends DifferentiableField with Product with Serializable

    Permalink

    The downsample operator which samples every factor input element to produce a reduced size output.

    The downsample operator which samples every factor input element to produce a reduced size output. The outputSize = ceil(inputSize / factor).

    Decided not to expose the "phase" parameter that exists with Cog's core downsample/upsample operators. There are some subtleties present in the Cog API, namely phase <= inSize-1 % factor. Put a different way, the Cog core's downsample() will result in a field of size ceil(inSize/factor). The specification of a non-zero phase should not disturb that. (inSize, factor, phase) = (5, 3, 2) is such a problem case where one might assume an output of size 1, but Cog will generate a size of 2.

    input

    input signal

    factor

    the factor by which the output is reduced

  8. case class FullyConnected(input: DifferentiableField, weights: DifferentiableField) extends DifferentiableField with Product with Serializable

    Permalink
  9. case class MaxPooling(input: DifferentiableField, poolSize: Int = 2, stride: Int = 2) extends DifferentiableField with Product with Serializable

    Permalink

    The max pooling function with a poolSize x poolSize input field stepped by stride.

    The max pooling function with a poolSize x poolSize input field stepped by stride. The input must be two dimensional.

    The ability to accomodate overlapping pools (where poolSize != stride) adds considerable complexity. In particular, the jacobianAdjoint must be prepared to sum multiple gradients (dY's) because of the potential spraying of values in the forward direction. Thus, there are two different implementation strategies taken for the two cases:

    Overlapped pools: The jacobianAdjoint GPUOperator allocates one thread per element of the larger 'dX' field that it generates to more naturally handle the summing that might occur into each such element. For performance, the jacobianAdjoint GPUOperator assumes and reads in a gradient-sized "index field" that contains the field offset of the input that is the maximum of the pool. The forward operator leverages the existence of the "index field" to generate its output as well.

    Non-overlapping pools: The jacobianAdjoint GPUOperator allocates one thread per element of the gradient 'dY' field and has that thread write the dY value to the appropriate 'dX' field element (no summing required). Since no "index field" is needed to help speed the jacobianAdjoint, the forward operator examines its input tile and outputs the maximum in a straightforward manner.

    The current approach might run faster by using local memory, but at the risk of not being able to accommodate large strides..

    input

    input signal

    poolSize

    the edge size of the square pooling window, defaults to 2

    stride

    the amount by which the pooling window is stepped (in both x and y), defaults to 2

  10. case class ReLU(input: DifferentiableField) extends DifferentiableField with Product with Serializable

    Permalink
  11. case class RightCrop(input: DifferentiableField, cropSizes: Seq[Int]) extends DifferentiableField with Product with Serializable

    Permalink

    Crop an N-dimensional input from the "right" (the highest-indexed data in each dimension).

    Crop an N-dimensional input from the "right" (the highest-indexed data in each dimension).

    input

    the input signal

    cropSizes

    the amount of padding to remove for all dimensions

  12. case class RightPad(input: DifferentiableField, sizes: Seq[Int]) extends DifferentiableField with Product with Serializable

    Permalink

    Pad an N-dimensional input with zeros on the "right" (after the data in each dimension)

    Pad an N-dimensional input with zeros on the "right" (after the data in each dimension)

    input

    the input signal

    sizes

    the amount of padding to add for all dimensions

  13. case class Softmax(input: DifferentiableField, safeMode: Boolean = true) extends DifferentiableField with Product with Serializable

    Permalink

    The softmax (multinomial logistic regression).

    The softmax (multinomial logistic regression). Converts the input to a form that could be considered a discrete probability distribution- i.e. all positive values that sum to 1.

    input

    The input signal, typically a classification output.

    safeMode

    Protect against generating NaNs for large inputs (>100).

  14. case class SpatialConvolution(input: DifferentiableField, weights: DifferentiableField, border: libcog.BorderPolicy = BorderValid, stride: Int = 1) extends DifferentiableField with Product with Serializable

    Permalink

    A convolutional transformation that applies a filter bank to a signal in the space domain.

    A convolutional transformation that applies a filter bank to a signal in the space domain.

    input

    The signal node

    weights

    The filter bank input, typically a TrainableState field

    stride

    The factor by which the output with be downsampled after the BorderValid convolution

  15. case class StackFeatures(left: DifferentiableField, right: DifferentiableField) extends DifferentiableField with Product with Serializable

    Permalink

    Binary compute node that stacks fields in the feature vector domain.

    Binary compute node that stacks fields in the feature vector domain. Both inputs must have the same field shape.

    left

    first input signal

    right

    second input signal, stacked on the first in the vector domain

  16. case class Subspace(input: DifferentiableField, ranges: Seq[Range]) extends DifferentiableField with Product with Serializable

    Permalink

    Pull a contiguous region out of a field.

    Pull a contiguous region out of a field.

    input

    the input signal

    ranges

    the ranges of interest of the input field, e.g. Seq(rowRanges, columnRanges)

  17. case class SumOfSquares(left: DifferentiableField, right: DifferentiableField) extends DifferentiableField with Product with Serializable

    Permalink
  18. case class Tanh(input: DifferentiableField, a: Float = 1.7159f, b: Float = 0.6667f) extends DifferentiableField with Product with Serializable

    Permalink

    The function a*tanh(b*x) applied at each point

    The function a*tanh(b*x) applied at each point

    input

    the input signal

    a

    scale parameter

    b

    gain parameter

  19. case class TrainableState(fieldShape: libcog.Shape, tensorShape: libcog.Shape, initPolicy: WeightInitPolicy, learningRule: LearningRule) extends DifferentiableField with Product with Serializable

    Permalink
  20. case class ZeroPad(input: DifferentiableField, size: Int) extends DifferentiableField with Product with Serializable

    Permalink

    Pad an input with zeros.

    Pad an input with zeros.

    input

    the input signal

    size

    pad size, in field points

Value Members

  1. object Convolution

    Permalink

    Helper function object for creating a convolutional Compute Node along with its associated State

  2. object Dropout

    Permalink
  3. object FrequencyConvolution extends libcog.Logarithm

    Permalink

Ungrouped