All Known Implementing Classes:
FixedSize, ParameterizedSize, ReferencedSize

public interface Size
An axis size. Can be fixed, data-dependent (unknown), parameterized, or based on another axis.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Constant to indicate that this element has no meaningful size for some context.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Size
    deserializeSize(com.google.gson.JsonDeserializationContext context, com.google.gson.JsonElement jsonElement, com.google.gson.JsonElement scale)
    Deserialize a size object from JSON.
    int
    Gets the minimum shape for this axis.
    int
    Get the step size of this axis size.
    int
    getTargetSize(int target)
    Get a size as close as possible to a target.
    int
    Get the default size of this axis.
    void
    validate(List<? extends BaseTensor> tensors)
    Validate a tensor's size, ensuring that all internal fields are valid and resolving links between tensor objects.
  • Field Details

    • NO_SIZE

      static final int NO_SIZE
      Constant to indicate that this element has no meaningful size for some context. For example, a fixed size (int value) has no meaningful step value.
      See Also:
  • Method Details

    • size

      int size()
      Get the default size of this axis. getTargetSize(int) may be more useful.
      Returns:
      The size of this axis.
    • getTargetSize

      int getTargetSize(int target)
      Get a size as close as possible to a target.
      Parameters:
      target - The target size.
      Returns:
      The fixed output size, NO_SIZE or as close as we can get to the target size.
    • getStep

      int getStep()
      Get the step size of this axis size.
      Returns:
      NO_SIZE for any axis without a step size, otherwise the size.
    • getMin

      int getMin()
      Gets the minimum shape for this axis.
      Returns:
      the minimum size in pixels
    • validate

      void validate(List<? extends BaseTensor> tensors)
      Validate a tensor's size, ensuring that all internal fields are valid and resolving links between tensor objects.
      Parameters:
      tensors - Tensors that may be referenced by this Size object.
    • deserializeSize

      static Size deserializeSize(com.google.gson.JsonDeserializationContext context, com.google.gson.JsonElement jsonElement, com.google.gson.JsonElement scale)
      Deserialize a size object from JSON.
      Parameters:
      context - The JSON context.
      jsonElement - the json element to be parsed.
      scale - the numeric scale that may or may not be needed
      Returns:
      A size parsed from the input json element if possible.