deeplake.util.shape_interval

class deeplake.util.shape_interval.ShapeInterval
__init__(lower: Sequence[int], upper: Sequence[int] | None = None)

Shapes in Deep Lake are best represented as intervals, this is to support dynamic tensors. Instead of having a single tuple of integers representing shape, we use 2 tuples of integers to represent the lower and upper bounds of the representing shape.

  • If lower == upper for all cases, the shape is considered “fixed”.

  • If lower != upper for any cases, the shape is considered “dynamic”.

Parameters:
  • lower (sequence) – Sequence of integers that represent the lower-bound shape.

  • upper (sequence) – Sequence of integers that represent the upper-bound shape. If None is provided, lower is used as upper (implicitly fixed-shape).

Raises:

InvalidShapeIntervalError – If the provided lower/upper bounds are incompatible to represent a shape.