Module tensor

Module tensor 

Source
Expand description

Tensor-aware block types for neural network data.

This module provides specialized types for storing and managing tensor data in a content-addressed manner. Tensors are the fundamental data structure in machine learning frameworks like PyTorch and TensorFlow.

§Example

use ipfrs_core::tensor::{TensorBlock, TensorDtype, TensorShape};
use bytes::Bytes;

// Create a 2x3 f32 tensor
let shape = TensorShape::new(vec![2, 3]);
let data = Bytes::from(vec![
    0f32.to_le_bytes(), 1f32.to_le_bytes(),
    2f32.to_le_bytes(), 3f32.to_le_bytes(),
    4f32.to_le_bytes(), 5f32.to_le_bytes(),
].concat());

let tensor = TensorBlock::new(data, shape, TensorDtype::F32).unwrap();
assert_eq!(tensor.element_count(), 6);

Structs§

TensorBlock
A content-addressed tensor block
TensorMetadata
Tensor metadata
TensorShape
Tensor shape (dimensions)

Enums§

TensorDtype
Supported tensor data types