Metadata describing serialized sample in a memory buffer. It is passed through memory, stored after sample it describes.
| 108 | |
| 109 | |
| 110 | class SampleMeta: |
| 111 | """Metadata describing serialized sample in a memory buffer. |
| 112 | |
| 113 | It is passed through memory, stored after sample it describes.""" |
| 114 | |
| 115 | def __init__(self, offset, shape, dtype, nbytes): |
| 116 | self.shape = shape |
| 117 | self.dtype = dtype |
| 118 | self.offset = offset |
| 119 | self.nbytes = nbytes |
| 120 | |
| 121 | @classmethod |
| 122 | def from_np(cls, offset, np_array): |
| 123 | return cls(offset, np_array.shape, np_array.dtype, np_array.nbytes) |
| 124 | |
| 125 | |
| 126 | class SharedBatchMeta: |