ImageLayout

Memory layout for image tensor data.

Different frameworks use different conventions for storing image data:

  • PyTorch typically uses CHW (channels first)

  • TensorFlow typically uses HWC (channels last)

  • Batched versions add a batch dimension at the front

Entries

Link copied to clipboard

Height × Width × Channels (e.g., OpenCV, TensorFlow default). Shape: H, W, C

Link copied to clipboard

Channels × Height × Width (e.g., PyTorch default). Shape: C, H, W

Link copied to clipboard

Batch × Height × Width × Channels (e.g., TensorFlow batched). Shape: N, H, W, C

Link copied to clipboard

Batch × Channels × Height × Width (e.g., PyTorch batched). Shape: N, C, H, W

Properties

Link copied to clipboard

Index of the channel dimension in the shape array.

Link copied to clipboard

Returns a representation of an immutable list of all enum entries, in the order they're declared.

Link copied to clipboard

Expected tensor rank for this layout.

Link copied to clipboard

Index of the height dimension in the shape array.

Link copied to clipboard

Whether this layout includes a batch dimension.

Link copied to clipboard

Whether channels are the first spatial dimension (after batch if present).

Link copied to clipboard

Index of the width dimension in the shape array.

Functions

Link copied to clipboard

Convert to batched version of this layout.

Link copied to clipboard

Convert to unbatched version of this layout.

Link copied to clipboard

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.