- 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
FieldsModifier and TypeFieldDescriptionstatic final intConstant to indicate that this element has no meaningful size for some context. -
Method Summary
Modifier and TypeMethodDescriptionstatic SizedeserializeSize(com.google.gson.JsonDeserializationContext context, com.google.gson.JsonElement jsonElement, com.google.gson.JsonElement scale) Deserialize a size object from JSON.intgetMin()Gets the minimum shape for this axis.intgetStep()Get the step size of this axis size.intgetTargetSize(int target) Get a size as close as possible to a target.intsize()Get the default size of this axis.voidvalidate(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_SIZEConstant 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_SIZEor as close as we can get to the target size.
-
getStep
int getStep()Get the step size of this axis size.- Returns:
NO_SIZEfor 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
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.
-