public class SpaceToBatch extends AbstractLayer<SpaceToBatchLayer>
Does a 2-dimensional space to batch operation, i.e. ransforms data from a tensor from 2 spatial dimensions into batch dimension according to the "blocks" specified (a vector of length 2). Afterwards the spatial dimensions are optionally padded, as specified in "padding", a tensor of dim (2, 2), denoting the padding range.
Example: input: [[[[1], [2]], [[3], [4]]]] input shape: [1, 2, 2, 1] blocks: [2, 2] padding: [[0, 0], [0, 0]]
output: [[[[1]]], [[[2]]], [[[3]]], [[[4]]]] output shape: [4, 1, 1, 1]
Layer.TrainingMode, Layer.TypecacheMode, conf, dropoutApplied, dropoutMask, epochCount, index, input, iterationCount, maskArray, maskState, preOutput, trainingListeners| Constructor and Description |
|---|
SpaceToBatch(NeuralNetConfiguration conf) |
SpaceToBatch(NeuralNetConfiguration conf,
org.nd4j.linalg.api.ndarray.INDArray input) |
| Modifier and Type | Method and Description |
|---|---|
void |
accumulateScore(double accum)
Sets a rolling tally for the score.
|
org.nd4j.linalg.api.ndarray.INDArray |
activate(boolean training,
LayerWorkspaceMgr workspaceMgr)
Perform forward pass and return the activations array with the last set input
|
org.nd4j.linalg.primitives.Pair<Gradient,org.nd4j.linalg.api.ndarray.INDArray> |
backpropGradient(org.nd4j.linalg.api.ndarray.INDArray epsilon,
LayerWorkspaceMgr workspaceMgr)
Calculate the gradient relative to the error in the next layer
|
double |
calcL1(boolean backpropParamsOnly)
Calculate the l1 regularization term
0.0 if regularization is not used. |
double |
calcL2(boolean backpropParamsOnly)
Calculate the l2 regularization term
0.0 if regularization is not used. |
void |
clearNoiseWeightParams() |
Layer |
clone()
Clone the layer
|
org.nd4j.linalg.api.ndarray.INDArray |
getParam(String param)
Get the parameter
|
Gradient |
gradient()
Get the gradient.
|
boolean |
isPretrainLayer()
Returns true if the layer can be trained in an unsupervised/pretrain manner (AE, VAE, etc)
|
int |
numParams()
The number of parameters for the model
|
org.nd4j.linalg.api.ndarray.INDArray |
params()
Returns the parameters of the neural network as a flattened row vector
|
protected org.nd4j.linalg.api.ndarray.INDArray |
preOutput(boolean training,
boolean forBackprop,
LayerWorkspaceMgr workspaceMgr) |
double |
score()
The score for the model
|
void |
setParams(org.nd4j.linalg.api.ndarray.INDArray params)
Set the parameters for this model.
|
Layer |
transpose()
Return a transposed copy of the weights/bias
(this means reverse the number of inputs and outputs on the weights)
|
Layer.Type |
type()
Returns the layer type
|
void |
update(org.nd4j.linalg.api.ndarray.INDArray gradient,
String paramType)
Perform one update applying the gradient
|
activate, addListeners, applyConstraints, applyDropOutIfNecessary, applyMask, assertInputSet, batchSize, clear, computeGradientAndScore, conf, feedForwardMaskArray, fit, fit, getGradientsViewArray, getIndex, getInput, getInputMiniBatchSize, getListeners, getMaskArray, getOptimizer, gradientAndScore, init, initParams, input, layerConf, layerId, numParams, paramTable, paramTable, setBackpropGradientsViewArray, setCacheMode, setConf, setIndex, setInput, setInputMiniBatchSize, setListeners, setListeners, setMaskArray, setParam, setParams, setParamsViewArray, setParamTable, update, validateInputequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetEpochCount, getIterationCount, setEpochCount, setIterationCountpublic SpaceToBatch(NeuralNetConfiguration conf)
public SpaceToBatch(NeuralNetConfiguration conf, org.nd4j.linalg.api.ndarray.INDArray input)
public Layer.Type type()
Layertype in interface Layertype in class AbstractLayer<SpaceToBatchLayer>public org.nd4j.linalg.primitives.Pair<Gradient,org.nd4j.linalg.api.ndarray.INDArray> backpropGradient(org.nd4j.linalg.api.ndarray.INDArray epsilon, LayerWorkspaceMgr workspaceMgr)
Layerepsilon - 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 managerprotected org.nd4j.linalg.api.ndarray.INDArray preOutput(boolean training,
boolean forBackprop,
LayerWorkspaceMgr workspaceMgr)
public org.nd4j.linalg.api.ndarray.INDArray activate(boolean training,
LayerWorkspaceMgr workspaceMgr)
Layertraining - training or test modeworkspaceMgr - Workspace managerArrayType.ACTIVATIONS workspace via the workspace managerpublic double calcL2(boolean backpropParamsOnly)
LayercalcL2 in interface LayercalcL2 in class AbstractLayer<SpaceToBatchLayer>backpropParamsOnly - If true: calculate L2 based on backprop params only. If false: calculate
based on all params (including pretrain params, if any)public double calcL1(boolean backpropParamsOnly)
LayercalcL1 in interface LayercalcL1 in class AbstractLayer<SpaceToBatchLayer>backpropParamsOnly - If true: calculate L1 based on backprop params only. If false: calculate
based on all params (including pretrain params, if any)public Layer transpose()
Layertranspose in interface Layertranspose in class AbstractLayer<SpaceToBatchLayer>public Layer clone()
Layerclone in interface Layerclone in class AbstractLayer<SpaceToBatchLayer>public boolean isPretrainLayer()
Layerpublic void clearNoiseWeightParams()
public Gradient gradient()
ModelModel#computeGradientAndScore() .gradient in interface Modelgradient in class AbstractLayer<SpaceToBatchLayer>public int numParams()
AbstractLayernumParams in interface ModelnumParams in class AbstractLayer<SpaceToBatchLayer>public double score()
Modelscore in interface Modelscore in class AbstractLayer<SpaceToBatchLayer>public void accumulateScore(double accum)
ModelaccumulateScore in interface ModelaccumulateScore in class AbstractLayer<SpaceToBatchLayer>accum - the amount to accumpublic void update(org.nd4j.linalg.api.ndarray.INDArray gradient,
String paramType)
Modelupdate in interface Modelupdate in class AbstractLayer<SpaceToBatchLayer>gradient - the gradient to applypublic org.nd4j.linalg.api.ndarray.INDArray params()
AbstractLayerparams in interface Modelparams in class AbstractLayer<SpaceToBatchLayer>public org.nd4j.linalg.api.ndarray.INDArray getParam(String param)
ModelgetParam in interface ModelgetParam in class AbstractLayer<SpaceToBatchLayer>param - the key of the parameterpublic void setParams(org.nd4j.linalg.api.ndarray.INDArray params)
ModelsetParams in interface ModelsetParams in class AbstractLayer<SpaceToBatchLayer>params - the parameters for the modelCopyright © 2018. All rights reserved.