Package org.deeplearning4j.nn.conf
Class MultiLayerConfiguration.Builder
- java.lang.Object
-
- org.deeplearning4j.nn.conf.MultiLayerConfiguration.Builder
-
- Direct Known Subclasses:
NeuralNetConfiguration.ListBuilder
- Enclosing class:
- MultiLayerConfiguration
public static class MultiLayerConfiguration.Builder extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected BackpropType
backpropType
protected CacheMode
cacheMode
protected List<NeuralNetConfiguration>
confs
protected double
dampingFactor
protected DataType
dataType
protected WorkspaceMode
inferenceWorkspaceMode
protected Map<Integer,InputPreProcessor>
inputPreProcessors
protected InputType
inputType
protected boolean
overrideNinUponBuild
protected int
tbpttBackLength
protected int
tbpttFwdLength
protected WorkspaceMode
trainingWorkspaceMode
protected boolean
validateOutputConfig
protected boolean
validateTbpttConfig
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description MultiLayerConfiguration.Builder
backpropType(@NonNull BackpropType type)
The type of backprop.MultiLayerConfiguration
build()
MultiLayerConfiguration.Builder
cacheMode(@NonNull CacheMode cacheMode)
This method defines how/if preOutput cache is handled: NONE: cache disabled (default value) HOST: Host memory will be used DEVICE: GPU memory will be used (on CPU backends effect will be the same as for HOST)MultiLayerConfiguration.Builder
confs(List<NeuralNetConfiguration> confs)
MultiLayerConfiguration.Builder
dataType(@NonNull DataType dataType)
Set the DataType for the network parameters and activations for all layers in the network.MultiLayerConfiguration.Builder
inferenceWorkspaceMode(@NonNull WorkspaceMode workspaceMode)
MultiLayerConfiguration.Builder
inputPreProcessor(Integer layer, InputPreProcessor processor)
Specify the processors.MultiLayerConfiguration.Builder
inputPreProcessors(Map<Integer,InputPreProcessor> processors)
MultiLayerConfiguration.Builder
overrideNinUponBuild(boolean overrideNinUponBuild)
Whether to over ride the nIn configuration forcibly upon construction.MultiLayerConfiguration.Builder
setInputType(InputType inputType)
MultiLayerConfiguration.Builder
tBPTTBackwardLength(int backwardLength)
When doing truncated BPTT: how many steps of backward should we do?
Only applicable when doing backpropType(BackpropType.TruncatedBPTT)
This is the k2 parameter on pg23 of http://www.cs.utoronto.ca/~ilya/pubs/ilya_sutskever_phd_thesis.pdfMultiLayerConfiguration.Builder
tBPTTForwardLength(int forwardLength)
When doing truncated BPTT: how many steps of forward pass should we do before doing (truncated) backprop?
Only applicable when doing backpropType(BackpropType.TruncatedBPTT)
Typically tBPTTForwardLength parameter is same as the tBPTTBackwardLength parameter, but may be larger than it in some circumstances (but never smaller)
Ideally your training data time series length should be divisible by this This is the k1 parameter on pg23 of http://www.cs.utoronto.ca/~ilya/pubs/ilya_sutskever_phd_thesis.pdfMultiLayerConfiguration.Builder
tBPTTLength(int bpttLength)
When doing truncated BPTT: how many steps should we do?
Only applicable when doing backpropType(BackpropType.TruncatedBPTT)
See: http://www.cs.utoronto.ca/~ilya/pubs/ilya_sutskever_phd_thesis.pdfMultiLayerConfiguration.Builder
trainingWorkspaceMode(@NonNull WorkspaceMode workspaceMode)
MultiLayerConfiguration.Builder
validateOutputLayerConfig(boolean validate)
Enabled by default.MultiLayerConfiguration.Builder
validateTbpttConfig(boolean validate)
Enabled by default.
-
-
-
Field Detail
-
confs
protected List<NeuralNetConfiguration> confs
-
dampingFactor
protected double dampingFactor
-
inputPreProcessors
protected Map<Integer,InputPreProcessor> inputPreProcessors
-
backpropType
protected BackpropType backpropType
-
tbpttFwdLength
protected int tbpttFwdLength
-
tbpttBackLength
protected int tbpttBackLength
-
inputType
protected InputType inputType
-
trainingWorkspaceMode
protected WorkspaceMode trainingWorkspaceMode
-
inferenceWorkspaceMode
protected WorkspaceMode inferenceWorkspaceMode
-
cacheMode
protected CacheMode cacheMode
-
validateOutputConfig
protected boolean validateOutputConfig
-
validateTbpttConfig
protected boolean validateTbpttConfig
-
dataType
protected DataType dataType
-
overrideNinUponBuild
protected boolean overrideNinUponBuild
-
-
Method Detail
-
overrideNinUponBuild
public MultiLayerConfiguration.Builder overrideNinUponBuild(boolean overrideNinUponBuild)
Whether to over ride the nIn configuration forcibly upon construction. Default value is true- Parameters:
overrideNinUponBuild
- Whether to over ride the nIn configuration forcibly upon construction.- Returns:
- builder pattern
-
inputPreProcessor
public MultiLayerConfiguration.Builder inputPreProcessor(Integer layer, InputPreProcessor processor)
Specify the processors. These are used at each layer for doing things like normalization and shaping of input.- Parameters:
processor
- what to use to preProcess the data.- Returns:
- builder pattern
-
inputPreProcessors
public MultiLayerConfiguration.Builder inputPreProcessors(Map<Integer,InputPreProcessor> processors)
-
trainingWorkspaceMode
@Deprecated public MultiLayerConfiguration.Builder trainingWorkspaceMode(@NonNull @NonNull WorkspaceMode workspaceMode)
-
inferenceWorkspaceMode
@Deprecated public MultiLayerConfiguration.Builder inferenceWorkspaceMode(@NonNull @NonNull WorkspaceMode workspaceMode)
-
cacheMode
public MultiLayerConfiguration.Builder cacheMode(@NonNull @NonNull CacheMode cacheMode)
This method defines how/if preOutput cache is handled: NONE: cache disabled (default value) HOST: Host memory will be used DEVICE: GPU memory will be used (on CPU backends effect will be the same as for HOST)- Parameters:
cacheMode
-- Returns:
-
backpropType
public MultiLayerConfiguration.Builder backpropType(@NonNull @NonNull BackpropType type)
The type of backprop. Default setting is used for most networks (MLP, CNN etc), but optionally truncated BPTT can be used for training recurrent neural networks. If using TruncatedBPTT make sure you set both tBPTTForwardLength() and tBPTTBackwardLength()
-
tBPTTLength
public MultiLayerConfiguration.Builder tBPTTLength(int bpttLength)
When doing truncated BPTT: how many steps should we do?
Only applicable when doing backpropType(BackpropType.TruncatedBPTT)
See: http://www.cs.utoronto.ca/~ilya/pubs/ilya_sutskever_phd_thesis.pdf- Parameters:
bpttLength
- length > 0
-
tBPTTForwardLength
public MultiLayerConfiguration.Builder tBPTTForwardLength(int forwardLength)
When doing truncated BPTT: how many steps of forward pass should we do before doing (truncated) backprop?
Only applicable when doing backpropType(BackpropType.TruncatedBPTT)
Typically tBPTTForwardLength parameter is same as the tBPTTBackwardLength parameter, but may be larger than it in some circumstances (but never smaller)
Ideally your training data time series length should be divisible by this This is the k1 parameter on pg23 of http://www.cs.utoronto.ca/~ilya/pubs/ilya_sutskever_phd_thesis.pdf- Parameters:
forwardLength
- Forward length > 0, >= backwardLength
-
tBPTTBackwardLength
public MultiLayerConfiguration.Builder tBPTTBackwardLength(int backwardLength)
When doing truncated BPTT: how many steps of backward should we do?
Only applicable when doing backpropType(BackpropType.TruncatedBPTT)
This is the k2 parameter on pg23 of http://www.cs.utoronto.ca/~ilya/pubs/ilya_sutskever_phd_thesis.pdf- Parameters:
backwardLength
- <= forwardLength
-
confs
public MultiLayerConfiguration.Builder confs(List<NeuralNetConfiguration> confs)
-
setInputType
public MultiLayerConfiguration.Builder setInputType(InputType inputType)
-
validateOutputLayerConfig
public MultiLayerConfiguration.Builder validateOutputLayerConfig(boolean validate)
Enabled by default. If enabled, the output layer configuration will be validated, to throw an exception on likely invalid outputs - such as softmax + nOut=1, or LossMCXENT + Tanh.
If disabled (false) no output layer validation will be performed.
Disabling this validation is not recommended, as the configurations that fail validation usually will not be able to learn correctly. However, the option to disable this validation is provided for advanced users when creating non-standard architectures.- Parameters:
validate
- If true: validate output layer configuration. False: don't validate
-
validateTbpttConfig
public MultiLayerConfiguration.Builder validateTbpttConfig(boolean validate)
Enabled by default. If enabled, an exception will be throw when using the (invalid) combination of truncated backpropagation through time (TBPTT) with either a GlobalPoolingLayer or LastTimeStepLayer.
It is possible to disable this validation to allow what is almost certainly an invalid configuration to be used, however this is not recommended.- Parameters:
validate
- Whether TBPTT validation should be performed
-
dataType
public MultiLayerConfiguration.Builder dataType(@NonNull @NonNull DataType dataType)
Set the DataType for the network parameters and activations for all layers in the network. Default: Float- Parameters:
dataType
- Datatype to use for parameters and activations
-
build
public MultiLayerConfiguration build()
-
-