public abstract class AbstractLayer extends Object implements Layer, Serializable
Constructor and Description |
---|
AbstractLayer(ActivationType activationType) |
Modifier and Type | Method and Description |
---|---|
abstract void |
applyWeightChanges()
Applies weight changes to current weights Must be diferent for
convolutional does nothing for MaxPooling Same for FullyConnected and
OutputLayer
|
abstract void |
backward()
This method should implement backward pass in subclasses
|
abstract void |
forward()
This method should implement forward pass in subclasses
|
ActivationFunction |
getActivation() |
ActivationType |
getActivationType() |
float |
getBatchSize() |
float[] |
getBiases() |
float[] |
getDeltaBiases() |
Tensor |
getDeltas()
Returns layer deltas/errors (as a tensor).
|
Tensor |
getDeltaWeights() |
int |
getDepth() |
Tensor |
getGradients() |
int |
getHeight() |
float |
getL1Regularization() |
float |
getL1WeightSum() |
float |
getL2Regularization() |
float |
getL2WeightSum() |
float |
getLearningRate() |
float |
getMomentum() |
AbstractLayer |
getNextLayer() |
Optimizer |
getOptimizer() |
OptimizerType |
getOptimizerType() |
Tensor |
getOutputs()
Returns layer outputs (as a tensor).
|
float[] |
getPrevDeltaBiases() |
Tensor |
getPrevDeltaWeights() |
AbstractLayer |
getPrevlayer() |
Tensor |
getWeights() |
int |
getWidth() |
abstract void |
init()
This method should implement layer initialization in subclasses, when a layer is added to
the network (create weights, outputs, deltas, randomization etc.).
|
void |
initTransientFields() |
boolean |
isBatchMode() |
boolean |
isTrainable() |
void |
setBatchMode(boolean batchMode) |
void |
setBatchSize(int batchSize) |
void |
setBiases(float[] biases) |
void |
setDeltas(Tensor deltas) |
void |
setL1Regularization(float regL1) |
void |
setL2Regularization(float regL2) |
void |
setLearningRate(float learningRate) |
void |
setMomentum(float momentum) |
void |
setNextlayer(AbstractLayer nextlayer) |
void |
setOptimizerType(OptimizerType optType) |
void |
setOutputs(Tensor outputs) |
void |
setPrevDeltaWeights(Tensor prevDeltaWeights) |
void |
setPrevLayer(AbstractLayer prevLayer) |
void |
setTrainable(boolean trainable)
Set trainable to false to freeze learned weights.
|
void |
setWeights(String weightStr) |
void |
setWeights(Tensor weights) |
public AbstractLayer(ActivationType activationType)
public abstract void init()
public abstract void forward()
public abstract void backward()
public abstract void applyWeightChanges()
public int getWidth()
public int getHeight()
public int getDepth()
public AbstractLayer getPrevlayer()
public void setPrevLayer(AbstractLayer prevLayer)
public void setNextlayer(AbstractLayer nextlayer)
public AbstractLayer getNextLayer()
public Tensor getWeights()
public float[] getBiases()
public void setBiases(float[] biases)
public final Tensor getOutputs()
Layer
getOutputs
in interface Layer
public final Tensor getDeltas()
Layer
public final Tensor getGradients()
public Tensor getDeltaWeights()
public Tensor getPrevDeltaWeights()
public void setPrevDeltaWeights(Tensor prevDeltaWeights)
public float[] getPrevDeltaBiases()
public float[] getDeltaBiases()
public final void setOutputs(Tensor outputs)
public void setWeights(Tensor weights)
public void setWeights(String weightStr)
public final void setDeltas(Tensor deltas)
public ActivationFunction getActivation()
public Optimizer getOptimizer()
public float getLearningRate()
public void setLearningRate(float learningRate)
public boolean isBatchMode()
public void setBatchMode(boolean batchMode)
public float getBatchSize()
public void setBatchSize(int batchSize)
public void setMomentum(float momentum)
public float getMomentum()
public OptimizerType getOptimizerType()
public void setOptimizerType(OptimizerType optType)
public ActivationType getActivationType()
public float getL1WeightSum()
public float getL2WeightSum()
public float getL2Regularization()
public void setL2Regularization(float regL2)
public float getL1Regularization()
public void setL1Regularization(float regL1)
public boolean isTrainable()
public void setTrainable(boolean trainable)
trainable
- public void initTransientFields()
Copyright © 2022. All rights reserved.