Package ai.djl.basicmodelzoo.basic
Class Mlp
- java.lang.Object
-
- ai.djl.nn.AbstractBaseBlock
-
- ai.djl.nn.AbstractBlock
-
- ai.djl.nn.SequentialBlock
-
- ai.djl.basicmodelzoo.basic.Mlp
-
- All Implemented Interfaces:
ai.djl.inference.streaming.StreamingBlock
,ai.djl.nn.Block
public class Mlp extends ai.djl.nn.SequentialBlock
Multilayer Perceptron (MLP) NeuralNetworks.A multilayer perceptron (MLP) is a feedforward artificial neural network that generates a set of outputs from a set of inputs. An MLP is characterized by several layers of input nodes connected as a directed graph between the input and output layers. MLP uses backpropogation for training the network.
MLP is widely used for solving problems that require supervised learning as well as research into computational neuroscience and parallel distributed processing. Applications include speech recognition, image recognition and machine translation.
- See Also:
- The D2L chapters on MLPs
-
-
Method Summary
-
Methods inherited from class ai.djl.nn.SequentialBlock
add, add, add, addAll, addAll, addSingleton, addSingleton, forwardInternal, forwardInternal, forwardStreamIter, getOutputShapes, initializeChildBlocks, isReturnIntermediate, loadMetadata, removeLastBlock, replaceLastBlock, saveMetadata, setReturnIntermediate
-
Methods inherited from class ai.djl.nn.AbstractBlock
addChildBlock, addChildBlock, addChildBlockSingleton, addParameter, getChildren, getDirectParameters
-
Methods inherited from class ai.djl.nn.AbstractBaseBlock
beforeInitialize, cast, clear, describeInput, forward, forward, getInputShapes, getOutputDataTypes, getParameters, initialize, isInitialized, loadParameters, prepare, readInputShapes, saveInputShapes, saveParameters, setInitializer, setInitializer, setInitializer, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ai.djl.nn.Block
cast, clear, describeInput, forward, forward, forward, freezeParameters, getChildren, getDirectParameters, getInputShapes, getOutputDataTypes, getOutputShapes, getParameters, initialize, isInitialized, loadParameters, saveParameters, setInitializer, setInitializer, setInitializer
-
-
-
-
Constructor Detail
-
Mlp
public Mlp(int input, int output, int[] hidden)
Create an MLP NeuralNetwork using RELU.- Parameters:
input
- the size of the input vectoroutput
- the size of the output vectorhidden
- the sizes of all of the hidden layers
-
Mlp
public Mlp(int input, int output, int[] hidden, java.util.function.Function<ai.djl.ndarray.NDList,ai.djl.ndarray.NDList> activation)
Create an MLP NeuralNetwork.- Parameters:
input
- the size of the input vectoroutput
- the size of the output vectorhidden
- the sizes of all of the hidden layersactivation
- the activation function to use
-
-