ResourceSource
Represents a source of a resource, which can be a string (e.g., URL or file path), a number (e.g., resource ID), or an object (e.g., binary data).ScalarType
Enum representing the scalar types of tensors.TensorBuffer
Represents the data buffer of a tensor, which can be one of several typed array formats.TensorPtr
Represents a pointer to a tensor, including its data buffer, size dimensions, and scalar type.The data buffer of the tensor.
An array representing the size of each dimension of the tensor.
The scalar type of the tensor, as defined in the
ScalarType enum.LabelEnum
A readonly record mapping string keys to numeric or string values. Used to represent enum-like label maps for models.Triple
A readonly triple of values, typically used for per-channel normalization parameters.PixelData
Represents raw pixel data in RGB format for vision models. This type extends TensorPtr with constraints specific to image data:- dataPtr must be Uint8Array (8-bit unsigned integers)
- scalarType is always BYTE (ScalarType.BYTE)
- sizes represents [height, width, channels] where channels must be 3 (RGB)
RGB pixel data as Uint8Array. Expected format: RGB (3 channels), not RGBA or BGRA. Size must equal: width * height * 3.
Dimensions of the pixel data: [height, width, channels].
- sizes[0]: height (number of rows)
- sizes[1]: width (number of columns)
- sizes[2]: channels (must be 3 for RGB)
Scalar type is always BYTE for pixel data.
Example
Frame
Frame data for vision model processing.Pointer to native platform buffer (zero-copy, best performance).
- On iOS: CVPixelBufferRef pointer
- On Android: AHardwareBuffer* pointer
frame.getNativeBuffer().pointer