public abstract class BaseGraphVertex extends Object implements GraphVertex
Modifier and Type | Field and Description |
---|---|
protected DataType |
dataType |
protected INDArray |
epsilon |
protected ComputationGraph |
graph |
protected INDArray[] |
inputs |
protected VertexIndices[] |
inputVertices
A representation of the vertices that are inputs to this vertex (inputs during forward pass)
Specifically, if inputVertices[X].getVertexIndex() = Y, and inputVertices[X].getVertexEdgeNumber() = Z
then the Zth output of vertex Y is the Xth input to this vertex
|
protected boolean |
outputVertex |
protected VertexIndices[] |
outputVertices
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 output of this vertex (there is only one output) is connected to the Zth input of vertex Y
|
protected int |
vertexIndex
The index of this vertex
|
protected String |
vertexName |
Modifier | Constructor and Description |
---|---|
protected |
BaseGraphVertex(ComputationGraph graph,
String name,
int vertexIndex,
VertexIndices[] inputVertices,
VertexIndices[] outputVertices,
DataType dataType) |
Modifier and Type | Method and 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 vertex
|
TrainingConfig |
getConfig() |
INDArray |
getEpsilon()
Get the epsilon/error (i.e., dL/dOutput) array previously set for this GraphVertex
|
INDArray |
getGradientsViewArray() |
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 of vertex Y is the Xth input to this vertex |
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 Y
|
int |
getVertexIndex()
Get the index of the GraphVertex
|
String |
getVertexName()
Get the name/label of the GraphVertex
|
boolean |
isInputVertex()
Whether the GraphVertex is an input vertex
|
long |
numParams() |
INDArray |
params() |
Map<String,INDArray> |
paramTable(boolean backpropOnly)
Get the parameter table for the vertex
|
void |
setEpsilon(INDArray epsilon)
Set the errors (epsilon - aka dL/dActivation) for this GraphVertex
|
void |
setInput(int inputNumber,
INDArray input,
LayerWorkspaceMgr workspaceMgr)
Set the input activations.
|
void |
setInputVertices(VertexIndices[] inputVertices)
Sets the input vertices.
|
void |
setLayerAsFrozen()
Only applies to layer vertices.
|
void |
setOutputVertices(VertexIndices[] outputVertices)
set the output vertices.
|
abstract String |
toString() |
boolean |
updaterDivideByMinibatch(String paramName)
DL4J layers typically produce the sum of the gradients during the backward pass for each layer, and if required
(if minibatch=true) then divide by the minibatch size.
However, there are some exceptions, such as the batch norm mean/variance estimate parameters: these "gradients" are actually not gradients, but are updates to be applied directly to the parameter vector. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
doBackward, doForward, feedForwardMaskArrays, getInputs, getLayer, hasLayer, isOutputVertex, setBackpropGradientsViewArray, setInputs, setOutputVertex
protected ComputationGraph graph
protected String vertexName
protected int vertexIndex
protected VertexIndices[] inputVertices
protected VertexIndices[] outputVertices
protected INDArray[] inputs
protected INDArray epsilon
protected boolean outputVertex
protected DataType dataType
protected BaseGraphVertex(ComputationGraph graph, String name, int vertexIndex, VertexIndices[] inputVertices, VertexIndices[] outputVertices, DataType dataType)
public String getVertexName()
GraphVertex
getVertexName
in interface GraphVertex
public int getVertexIndex()
GraphVertex
getVertexIndex
in interface GraphVertex
public int getNumInputArrays()
GraphVertex
getNumInputArrays
in interface GraphVertex
public int getNumOutputConnections()
GraphVertex
getNumOutputConnections
in interface GraphVertex
public VertexIndices[] getInputVertices()
getInputVertices
in interface GraphVertex
public void setInputVertices(VertexIndices[] inputVertices)
GraphVertex
setInputVertices
in interface GraphVertex
GraphVertex.getInputVertices()
public VertexIndices[] getOutputVertices()
getOutputVertices
in interface GraphVertex
public void setOutputVertices(VertexIndices[] outputVertices)
GraphVertex
setOutputVertices
in interface GraphVertex
GraphVertex.getOutputVertices()
public boolean isInputVertex()
GraphVertex
isInputVertex
in interface GraphVertex
public void setInput(int inputNumber, INDArray input, LayerWorkspaceMgr workspaceMgr)
GraphVertex
setInput
in interface GraphVertex
inputNumber
- Must be in range 0 to GraphVertex.getNumInputArrays()
-1input
- The input arraypublic void setEpsilon(INDArray epsilon)
GraphVertex
setEpsilon
in interface GraphVertex
public void clear()
GraphVertex
clear
in interface GraphVertex
public boolean canDoForward()
GraphVertex
canDoForward
in interface GraphVertex
public boolean canDoBackward()
GraphVertex
canDoBackward
in interface GraphVertex
public INDArray getEpsilon()
GraphVertex
getEpsilon
in interface GraphVertex
public void setLayerAsFrozen()
GraphVertex
setLayerAsFrozen
in interface GraphVertex
public void clearVertex()
GraphVertex
clearVertex
in interface GraphVertex
public Map<String,INDArray> paramTable(boolean backpropOnly)
GraphVertex
paramTable
in interface Trainable
paramTable
in interface GraphVertex
backpropOnly
- If true: exclude unsupervised training parameterspublic long numParams()
public TrainingConfig getConfig()
public INDArray params()
public INDArray getGradientsViewArray()
getGradientsViewArray
in interface Trainable
public boolean updaterDivideByMinibatch(String paramName)
Trainable
updaterDivideByMinibatch
in interface Trainable
paramName
- Name of the parameterCopyright © 2021. All rights reserved.