Mila 0.13.48
Deep Neural Network Library
Loading...
Searching...
No Matches
Tensor.Serialization.ixx File Reference

Tensor-specific serialization helpers and metadata. More...

#include <string>
#include <cstddef>
#include <stdexcept>
#include <utility>
import Compute.CpuMemoryResource;
import Dnn.TensorTypes;
import Dnn.TensorDataTypeTraits;
import Dnn.TensorDataType;
import Dnn.TensorBuffer;
import Serialization.Metadata;
import Serialization.ModelArchive;

Classes

struct  Mila::Dnn::Serialization::ITensorBlob
 Type-erased interface for a serialized tensor blob. More...
struct  Mila::Dnn::Serialization::TensorBlob< MR >
 Concrete tensor blob owning a TensorBuffer-backed raw byte buffer. More...
 Metadata describing a tensor in serialized form. More...

Namespaces

namespace  Mila
 Mila main API namespace.
namespace  Mila::Dnn
namespace  Mila::Dnn::Serialization

Functions

template<typename MR = Compute::CpuMemoryResource>
requires isValidTensor<dtype_t::UINT8, MR>
TensorBlob< MR > Mila::Dnn::Serialization::readTensorBlob (const ModelArchive &archive, const std::string &prefix, int device_id=0)
 Read tensor metadata and raw bytes from prefix into a typed blob.
void Mila::Dnn::Serialization::writeTensorBlob (ModelArchive &archive, const std::string &prefix, const TensorMetadata &meta, const void *data, size_t size)
 Write tensor metadata and raw bytes under the given prefix into archive.

Detailed Description

Tensor-specific serialization helpers and metadata.

Provides TensorMetadata, ITensorBlob, and free helpers to write/read tensor metadata + raw bytes using ModelArchive. This partition keeps tensor concerns out of ModelArchive and lets tensor implementations call these helpers.