Interface GraphVertex
-
- All Superinterfaces:
Serializable
,Trainable
- All Known Implementing Classes:
BaseGraphVertex
,BaseWrapperVertex
,DuplicateToTimeSeriesVertex
,ElementWiseVertex
,FrozenVertex
,InputVertex
,L2NormalizeVertex
,L2Vertex
,LastTimeStepVertex
,LayerVertex
,MergeVertex
,PoolHelperVertex
,PreprocessorVertex
,ReshapeVertex
,ReverseTimeSeriesVertex
,SameDiffGraphVertex
,ScaleVertex
,ShiftVertex
,StackVertex
,SubsetVertex
,UnstackVertex
public interface GraphVertex extends Trainable, Serializable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canDoBackward()
Whether the GraphVertex can do backward pass.boolean
canDoForward()
Whether the GraphVertex can do forward pass.void
clear()
Clear the internal state (if any) of the GraphVertex.void
clearVertex()
This method clears inpjut for this vertexPair<Gradient,INDArray[]>
doBackward(boolean tbptt, LayerWorkspaceMgr workspaceMgr)
Do backward passINDArray
doForward(boolean training, LayerWorkspaceMgr workspaceMgr)
Do forward pass using the stored inputsPair<INDArray,MaskState>
feedForwardMaskArrays(INDArray[] maskArrays, MaskState currentMaskState, int minibatchSize)
INDArray
getEpsilon()
Get the epsilon/error (i.e., dL/dOutput) array previously set for this GraphVertexINDArray[]
getInputs()
Get the array of inputs previously set for this GraphVertexVertexIndices[]
getInputVertices()
A representation of the vertices that are inputs to this vertex (inputs duing forward pass)
Specifically, if inputVertices[X].getVertexIndex() = Y, and inputVertices[X].getVertexEdgeNumber() = Z then the Zth output connection (seegetNumOutputConnections()
of vertex Y is the Xth input to this vertexLayer
getLayer()
Get the Layer (if any).int
getNumInputArrays()
Get the number of input arrays.int
getNumOutputConnections()
Get the number of outgoing connections from this GraphVertex.VertexIndices[]
getOutputVertices()
A representation of the vertices that this vertex is connected to (outputs duing forward pass) Specifically, if outputVertices[X].getVertexIndex() = Y, and outputVertices[X].getVertexEdgeNumber() = Z then the Xth output of this vertex is connected to the Zth input of vertex Yint
getVertexIndex()
Get the index of the GraphVertexString
getVertexName()
Get the name/label of the GraphVertexboolean
hasLayer()
Whether the GraphVertex contains aLayer
object or notboolean
isInputVertex()
Whether the GraphVertex is an input vertexboolean
isOutputVertex()
Whether the GraphVertex is an output vertexMap<String,INDArray>
paramTable(boolean backpropOnly)
Get the parameter table for the vertexvoid
setBackpropGradientsViewArray(INDArray backpropGradientsViewArray)
void
setEpsilon(INDArray epsilon)
Set the errors (epsilon - aka dL/dActivation) for this GraphVertexvoid
setInput(int inputNumber, INDArray input, LayerWorkspaceMgr workspaceMgr)
Set the input activations.void
setInputs(INDArray... inputs)
Set all inputs for this GraphVertexvoid
setInputVertices(VertexIndices[] inputVertices)
Sets the input vertices.void
setLayerAsFrozen()
Only applies to layer vertices.void
setOutputVertex(boolean outputVertex)
Set the GraphVertex to be an output vertexvoid
setOutputVertices(VertexIndices[] outputVertices)
set the output vertices.-
Methods inherited from interface org.deeplearning4j.nn.api.Trainable
getConfig, getGradientsViewArray, numParams, params, updaterDivideByMinibatch
-
-
-
-
Method Detail
-
getVertexName
String getVertexName()
Get the name/label of the GraphVertex
-
getVertexIndex
int getVertexIndex()
Get the index of the GraphVertex
-
getNumInputArrays
int getNumInputArrays()
Get the number of input arrays. For example, a Layer may have only one input array, but in general a GraphVertex may have an arbtrary (>=1) number of input arrays (for example, from multiple other layers)
-
getNumOutputConnections
int getNumOutputConnections()
Get the number of outgoing connections from this GraphVertex. A GraphVertex may only have a single output (for example, the activations out of a layer), but this output may be used as the input to an arbitrary number of other GraphVertex instances. This method returns the number of GraphVertex instances the output of this GraphVertex is input for.
-
getInputVertices
VertexIndices[] getInputVertices()
A representation of the vertices that are inputs to this vertex (inputs duing forward pass)
Specifically, if inputVertices[X].getVertexIndex() = Y, and inputVertices[X].getVertexEdgeNumber() = Z then the Zth output connection (seegetNumOutputConnections()
of vertex Y is the Xth input to this vertex
-
setInputVertices
void setInputVertices(VertexIndices[] inputVertices)
Sets the input vertices.- See Also:
getInputVertices()
-
getOutputVertices
VertexIndices[] getOutputVertices()
A representation of the vertices that this vertex is connected to (outputs duing forward pass) Specifically, if outputVertices[X].getVertexIndex() = Y, and outputVertices[X].getVertexEdgeNumber() = Z then the Xth output of this vertex is connected to the Zth input of vertex Y
-
setOutputVertices
void setOutputVertices(VertexIndices[] outputVertices)
set the output vertices.- See Also:
getOutputVertices()
-
hasLayer
boolean hasLayer()
Whether the GraphVertex contains aLayer
object or not
-
isInputVertex
boolean isInputVertex()
Whether the GraphVertex is an input vertex
-
isOutputVertex
boolean isOutputVertex()
Whether the GraphVertex is an output vertex
-
setOutputVertex
void setOutputVertex(boolean outputVertex)
Set the GraphVertex to be an output vertex
-
getLayer
Layer getLayer()
Get the Layer (if any). Returns null ifhasLayer()
== false
-
setInput
void setInput(int inputNumber, INDArray input, LayerWorkspaceMgr workspaceMgr)
Set the input activations.- Parameters:
inputNumber
- Must be in range 0 togetNumInputArrays()
-1input
- The input arrayworkspaceMgr
-
-
setEpsilon
void setEpsilon(INDArray epsilon)
Set the errors (epsilon - aka dL/dActivation) for this GraphVertex
-
clear
void clear()
Clear the internal state (if any) of the GraphVertex. For example, any stored inputs/errors
-
canDoForward
boolean canDoForward()
Whether the GraphVertex can do forward pass. Typically, this is just whether all inputs are set.
-
canDoBackward
boolean canDoBackward()
Whether the GraphVertex can do backward pass. Typically, this is just whether all errors/epsilons are set
-
doForward
INDArray doForward(boolean training, LayerWorkspaceMgr workspaceMgr)
Do forward pass using the stored inputs- Parameters:
training
- if true: forward pass at training time. If false: forward pass at test time- Returns:
- The output (for example, activations) of the GraphVertex
-
doBackward
Pair<Gradient,INDArray[]> doBackward(boolean tbptt, LayerWorkspaceMgr workspaceMgr)
Do backward pass- Parameters:
tbptt
- If true: do backprop using truncated BPTT- Returns:
- The gradients (may be null), and the errors/epsilons for all inputs to this GraphVertex
-
getInputs
INDArray[] getInputs()
Get the array of inputs previously set for this GraphVertex
-
getEpsilon
INDArray getEpsilon()
Get the epsilon/error (i.e., dL/dOutput) array previously set for this GraphVertex
-
setInputs
void setInputs(INDArray... inputs)
Set all inputs for this GraphVertex
-
setBackpropGradientsViewArray
void setBackpropGradientsViewArray(INDArray backpropGradientsViewArray)
- Parameters:
backpropGradientsViewArray
-
-
feedForwardMaskArrays
Pair<INDArray,MaskState> feedForwardMaskArrays(INDArray[] maskArrays, MaskState currentMaskState, int minibatchSize)
-
setLayerAsFrozen
void setLayerAsFrozen()
Only applies to layer vertices. Will throw exceptions on others. If applied to a layer vertex it will treat the parameters of the layer within it as constant. Activations through these will be calculated as they would as test time regardless of training mode
-
clearVertex
void clearVertex()
This method clears inpjut for this vertex
-
paramTable
Map<String,INDArray> paramTable(boolean backpropOnly)
Get the parameter table for the vertex- Specified by:
paramTable
in interfaceTrainable
- Parameters:
backpropOnly
- If true: exclude unsupervised training parameters- Returns:
- Parameter table
-
-