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:
  • Field Summary

    Fields inherited from class ai.djl.nn.AbstractBlock

    children, parameters

    Fields inherited from class ai.djl.nn.AbstractBaseBlock

    inputNames, inputShapes, outputDataTypes, version
  • Constructor Summary

    Constructors
    Constructor
    Description
    Mlp(int input, int output, int[] hidden)
    Create an MLP NeuralNetwork using RELU.
    Mlp(int input, int output, int[] hidden, Function<ai.djl.ndarray.NDList,ai.djl.ndarray.NDList> activation)
    Create an MLP NeuralNetwork.
  • 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, freezeParameters, getChildren, getDirectParameters, getInputShapes, getOutputDataTypes, getOutputShapes, getParameters, initialize, isInitialized, loadParameters, saveParameters, setInitializer, setInitializer, setInitializer

    Methods inherited from interface ai.djl.inference.streaming.StreamingBlock

    forwardStream, forwardStream
  • Constructor Details

    • Mlp

      public Mlp(int input, int output, int[] hidden)
      Create an MLP NeuralNetwork using RELU.
      Parameters:
      input - the size of the input vector
      output - the size of the output vector
      hidden - the sizes of all of the hidden layers
    • Mlp

      public Mlp(int input, int output, int[] hidden, Function<ai.djl.ndarray.NDList,ai.djl.ndarray.NDList> activation)
      Create an MLP NeuralNetwork.
      Parameters:
      input - the size of the input vector
      output - the size of the output vector
      hidden - the sizes of all of the hidden layers
      activation - the activation function to use