torch.DTypeComponents
export interface DTypeComponents {
// Built-in types (1 component each)
float32: { components: 1; componentType: 'float32' };
float16: { components: 1; componentType: 'float16' };
int32: { components: 1; componentType: 'int32' };
uint32: { components: 1; componentType: 'uint32' };
int8: { components: 1; componentType: 'int8' };
uint8: { components: 1; componentType: 'uint8' };
bool: { components: 1; componentType: 'uint8' };
// Complex types (2 components)
complex64: { components: 2; componentType: 'float32' };
}float32({ components: 1; componentType: 'float32' })float16({ components: 1; componentType: 'float16' })int32({ components: 1; componentType: 'int32' })uint32({ components: 1; componentType: 'uint32' })int8({ components: 1; componentType: 'int8' })uint8({ components: 1; componentType: 'uint8' })bool({ components: 1; componentType: 'uint8' })complex64({ components: 2; componentType: 'float32' })
Registry of dtype component information.
This interface defines how many base elements make up each dtype and what their underlying storage type is. Users can extend this via declaration merging for custom dtypes.
Examples
declare module '@torchjsorg/torch.js' {
interface DTypeComponents {
quaternion_f32: { components: 4; componentType: 'float32' };
}
}