Flat untyped CPU buffer descriptor produced by the Allocator.
Shared with CpuStorage so that the allocator's StoragePtr
abstraction can be threaded through tensor construction without an extra
copy or wrapper layer. Treat as an allocator-layer view of the same
underlying memory; CpuStorage is the tensor-layer wrapper.
See Also
CpuStorage — tensor-layer wrapper around the same bytes.
Attributes
ptrstd::shared_ptr<std::byte[]>Owning pointer to the byte buffer. Shared between every descriptor and tensor that references the same allocation.
nbytesstd::size_tAllocated capacity in bytes.
dtypeDtypeElement type stored in the buffer. Default
Dtype::F32.versionstd::shared_ptr<VersionCounter>Atomic mutation counter shared with every alias of this allocation.
Methods
2Atomically increments the version counter.
Uses memory_order_relaxed because version bumps are sequenced by
the surrounding op — autograd only inspects the counter at well-defined
synchronisation points (forward save / backward replay).
Atomically reads the current version counter value.
Returns
std::uint64_tMonotonically non-decreasing snapshot of mutation count.