Enum Class LayoutType

java.lang.Object
java.lang.Enum<LayoutType>
ai.djl.ndarray.types.LayoutType
All Implemented Interfaces:
Serializable, Comparable<LayoutType>, Constable

public enum LayoutType extends Enum<LayoutType>
An enum to represent the meaning of a particular axis in an NDArray.

The options are:

  • BATCH - Different elements in a batch, usually from a StackBatchifier.
  • CHANNEL - Each channel represents a different aspect of the data such as RGB showing different color channels.
  • DEPTH - The depth of a 3-D input
  • HEIGHT - The width of a multi-dimensional input, usually an image.
  • WIDTH - The height of a multi-dimensional input, usually an image.
  • TIME - The time within a sequence such as text or video.
  • UNKNOWN - A unknown or otherwise unrepresentable layout type.
  • Enum Constant Details

  • Method Details

    • values

      public static LayoutType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static LayoutType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getValue

      public char getValue()
      Returns the character representation of the layout type.
      Returns:
      the character representation of the layout type
    • fromValue

      public static LayoutType fromValue(char value)
      Converts the character to the matching layout type.
      Parameters:
      value - the character to convert
      Returns:
      the matching layout type
      Throws:
      IllegalArgumentException - thrown if the character does not match any layout type
    • fromValue

      public static LayoutType[] fromValue(String layout)
      Converts each character to the matching layout type.
      Parameters:
      layout - the character string to convert
      Returns:
      the list of layout types for each character in the string
      Throws:
      IllegalArgumentException - thrown if the character does not match any layout type
    • toString

      public static String toString(LayoutType[] layouts)
      Converts a layout type array to a string of the character representations.
      Parameters:
      layouts - the layout type to convert
      Returns:
      the string of the character representations