Tensor data as read from the file, which serializes tensors in PyTorch format.
| 93 | // Tensor data as read from the file, which serializes tensors |
| 94 | // in PyTorch format. |
| 95 | struct Tensor { |
| 96 | std::string name; |
| 97 | CodecDType dtype; |
| 98 | std::array<int, 4> shape = {0, 0, 0, 0}; |
| 99 | void* data = nullptr; // not managed by Tensor |
| 100 | size_t size; // size in bytes (number of elements * element size) |
| 101 | |
| 102 | // Returns 0 if successful, other if failed |
| 103 | int from_json(const std::string& name, const json& j, void* bytes_ptr, size_t bytes_size); |
| 104 | }; |
| 105 | |
| 106 | // Tensor with quantization metadata. |
| 107 | struct QTensor { |
nothing calls this directly
no outgoing calls
no test coverage detected