Package ai.djl.nn

Interface BlockFactory

All Superinterfaces:
Serializable
All Known Implementing Classes:
IdentityBlockFactory, OnesBlockFactory

public interface BlockFactory extends Serializable
Block factory is a component to make standard for block creating and saving procedure. Block factory design is intended to bypass the serialization of the blocks. This class can be used by ModelZoo or DJL Serving to recover the block to its uninitialized states. User should combine this method with the block.loadParameter to get the block with all parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    newBlock(Model model, Path modelPath, Map<String,?> arguments)
    Constructs the uninitialized block.
  • Method Details

    • newBlock

      Block newBlock(Model model, Path modelPath, Map<String,?> arguments) throws IOException
      Constructs the uninitialized block.
      Parameters:
      model - the model of the block
      modelPath - the directory of the model location
      arguments - the block creation arguments
      Returns:
      the uninitialized block
      Throws:
      IOException - if IO operation fails during creating block