What is a vertex?

In Eclipse Deeplearning4j a vertex is a type of layer that acts as a node in a ComputationGraph. It can accept multiple inputs, provide multiple outputs, and can help construct popular networks such as InceptionV4.

Available classes


L2NormalizeVertex

[source]

L2NormalizeVertex performs L2 normalization on a single input.


L2Vertex

[source]

L2Vertex calculates the L2 least squares error of two inputs.

For example, in Triplet Embedding you can input an anchor and a pos/neg class and use two parallelL2 vertices to calculate two real numbers which can be fed into a LossLayer to calculate TripletLoss.


PoolHelperVertex

[source]

A custom layer for removing the first column and row from an input. This is meant to allowimportation of Caffe’s GoogLeNet from https://gist.github.com/joelouismarino/a2ede9ab3928f999575423b9887abd14.


ReshapeVertex

[source]

Adds the ability to reshape and flatten the tensor in the computation graph. This is the equivalentto the next layer. ReshapeVertex also ensures the shape is valid for the backward pass.


ScaleVertex

[source]

A ScaleVertex is used to scale the size of activations of a single layerFor example, ResNet activations can be scaled in repeating blocks to keep varianceunder control.


ShiftVertex

[source]

A ShiftVertex is used to shift the activations of a single layerOne could use it to add a bias or as part of some other calculation.For example, Highway Layers need them in two places. One, it’s oftenuseful to have the gate weights have a large negative bias. (Of coursefor this, we could just initialize the biases that way.)But, also it needs to do this:(1-sigmoid(weight input + bias)) () input + sigmoid(weight input + bias) () activation(w2 input + bias) (() is hadamard product)So, here, we could have

  • a DenseLayer that does the sigmoid
  • a ScaleVertex(-1) and
  • a ShiftVertex(1)to accomplish that.

StackVertex

[source]

StackVertex allows for stacking of inputs so that they may be forwarded througha network. This is useful for cases such as Triplet Embedding, where shared parametersare not supported by the network.

This vertex will automatically stack all available inputs.


UnstackVertex

[source]

UnstackVertex allows for unstacking of inputs so that they may be forwarded througha network. This is useful for cases such as Triplet Embedding, where embeddings canbe separated and run through subsequent layers.

Works similarly to SubsetVertex, except on dimension 0 of the input. stackSize isexplicitly defined by the user to properly calculate an step.


ReverseTimeSeriesVertex

[source]

ReverseTimeSeriesVertex is used in recurrent neural networks to revert the order of time series.As a result, the last time step is moved to the beginning of the time series and the first time stepis moved to the end. This allows recurrent layers to backward process time series.

Masks: The input might be masked (to allow for varying time series lengths in one minibatch). In this case thepresent input (mask array = 1) will be reverted in place and the padding (mask array = 0) will be left untouched atthe same place. For a time series of length n, this would normally mean, that the first n time steps are reverted andthe following padding is left untouched, but more complex masks are supported (e.g. [1, 0, 1, 0, …].

setBackpropGradientsViewArray
  1. public void setBackpropGradientsViewArray(INDArray backpropGradientsViewArray)

Gets the current mask array from the provided input

  • return The mask or null, if no input was provided