public class CenterLossOutputLayer extends BaseOutputLayer<CenterLossOutputLayer>
Layer.TrainingMode, Layer.Type
inputMaskArray, inputMaskArrayState, labels
gradient, gradientsFlattened, gradientViews, optimizer, params, paramsFlattened, score, weightNoiseParams
cacheMode, conf, dataType, dropoutApplied, epochCount, index, input, inputModificationAllowed, iterationCount, maskArray, maskState, preOutput, trainingListeners
Constructor and Description |
---|
CenterLossOutputLayer(NeuralNetConfiguration conf,
DataType dataType) |
Modifier and Type | Method and Description |
---|---|
Pair<Gradient,INDArray> |
backpropGradient(INDArray epsilon,
LayerWorkspaceMgr workspaceMgr)
Calculate the gradient relative to the error in the next layer
|
void |
computeGradientAndScore(LayerWorkspaceMgr workspaceMgr)
Update the score
|
double |
computeScore(double fullNetRegTerm,
boolean training,
LayerWorkspaceMgr workspaceMgr)
Compute score after labels and input have been set.
|
INDArray |
computeScoreForExamples(double fullNetRegTerm,
LayerWorkspaceMgr workspaceMgr)
Compute the score for each example individually, after labels and input have been set.
|
protected INDArray |
getLabels2d(LayerWorkspaceMgr workspaceMgr,
ArrayType arrayType) |
Gradient |
gradient()
Gets the gradient from one training iteration
|
Pair<Gradient,Double> |
gradientAndScore()
Get the gradient and score
|
protected void |
setScoreWithZ(INDArray z) |
activate, applyMask, clear, f1Score, f1Score, fit, fit, fit, fit, fit, getLabels, hasBias, isPretrainLayer, needsLabels, numLabels, predict, predict, preOutput2d, setLabels
activate, calcRegularizationScore, clearNoiseWeightParams, clone, fit, getGradientsViewArray, getOptimizer, getParam, getParamWithNoise, hasLayerNorm, layerConf, numParams, params, paramTable, paramTable, preOutput, preOutputWithPreNorm, score, setBackpropGradientsViewArray, setParam, setParams, setParams, setParamsViewArray, setParamTable, toString, update, update
addListeners, allowInputModification, applyConstraints, applyDropOutIfNecessary, assertInputSet, backpropDropOutIfPresent, batchSize, close, conf, feedForwardMaskArray, getConfig, getEpochCount, getHelper, getIndex, getInput, getInputMiniBatchSize, getListeners, getMaskArray, init, input, layerId, numParams, setCacheMode, setConf, setEpochCount, setIndex, setInput, setInputMiniBatchSize, setListeners, setListeners, setMaskArray, type, updaterDivideByMinibatch
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
activate, allowInputModification, calcRegularizationScore, clearNoiseWeightParams, feedForwardMaskArray, getEpochCount, getHelper, getIndex, getInputMiniBatchSize, getIterationCount, getListeners, getMaskArray, setCacheMode, setEpochCount, setIndex, setInput, setInputMiniBatchSize, setIterationCount, setListeners, setListeners, setMaskArray, type
getConfig, getGradientsViewArray, numParams, params, paramTable, updaterDivideByMinibatch
addListeners, applyConstraints, batchSize, close, conf, fit, getGradientsViewArray, getOptimizer, getParam, init, input, numParams, numParams, params, paramTable, paramTable, score, setBackpropGradientsViewArray, setConf, setParam, setParams, setParamsViewArray, setParamTable, update, update
public CenterLossOutputLayer(NeuralNetConfiguration conf, DataType dataType)
public double computeScore(double fullNetRegTerm, boolean training, LayerWorkspaceMgr workspaceMgr)
computeScore
in interface IOutputLayer
computeScore
in class BaseOutputLayer<CenterLossOutputLayer>
fullNetRegTerm
- Regularization score term for the entire networktraining
- whether score should be calculated at train or test time (this affects things like application of
dropout, etc)public INDArray computeScoreForExamples(double fullNetRegTerm, LayerWorkspaceMgr workspaceMgr)
computeScoreForExamples
in interface IOutputLayer
computeScoreForExamples
in class BaseOutputLayer<CenterLossOutputLayer>
fullNetRegTerm
- Regularization term for the entire network (or, 0.0 to not include regularization)public void computeGradientAndScore(LayerWorkspaceMgr workspaceMgr)
Model
computeGradientAndScore
in interface Model
computeGradientAndScore
in class BaseOutputLayer<CenterLossOutputLayer>
protected void setScoreWithZ(INDArray z)
setScoreWithZ
in class BaseOutputLayer<CenterLossOutputLayer>
public Pair<Gradient,Double> gradientAndScore()
Model
gradientAndScore
in interface Model
gradientAndScore
in class BaseOutputLayer<CenterLossOutputLayer>
public Pair<Gradient,INDArray> backpropGradient(INDArray epsilon, LayerWorkspaceMgr workspaceMgr)
Layer
backpropGradient
in interface Layer
backpropGradient
in class BaseOutputLayer<CenterLossOutputLayer>
epsilon
- w^(L+1)*delta^(L+1). Or, equiv: dC/da, i.e., (dC/dz)*(dz/da) = dC/da, where C
is cost function a=sigma(z) is activation.workspaceMgr
- Workspace managerArrayType.ACTIVATION_GRAD
workspace via the workspace managerpublic Gradient gradient()
gradient
in interface Model
gradient
in class BaseOutputLayer<CenterLossOutputLayer>
protected INDArray getLabels2d(LayerWorkspaceMgr workspaceMgr, ArrayType arrayType)
getLabels2d
in class BaseOutputLayer<CenterLossOutputLayer>
Copyright © 2020. All rights reserved.