1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! Tensor-library-agnostic tensor entry for the burnpack format.
//!
//! The burnpack reader and writer operate on [`Tensor`] values, which carry only the
//! format-level information (name, dtype, shape, optional param id) plus the raw
//! little-endian [`Bytes`]. Keeping the bytes as [`Bytes`] (rather than a custom buffer
//! type) integrates with the rest of the Burn ecosystem: a reader can hand out
//! file-backed bytes ([`Bytes::from_file`]) for fast, lazy file-to-GPU transfers, while a
//! writer simply consumes already-materialized bytes.
use String;
use ;
/// A single tensor in a burnpack container, decoupled from any tensor library.
///
/// The [`bytes`](Self::bytes) field holds the tensor's data in little-endian layout,
/// matching the element count implied by [`shape`](Self::shape) and [`dtype`](Self::dtype).
/// When produced by a [`Reader`](crate::Reader) loading from a file, the bytes are
/// file-backed and only read from disk when accessed.