| 480 | |
| 481 | #if DEBUG_MODEL |
| 482 | struct DebugTensor { |
| 483 | enum struct DataType { |
| 484 | F32, |
| 485 | F16, |
| 486 | }; |
| 487 | |
| 488 | DebugTensor() = default; |
| 489 | DebugTensor(const std::vector<float>& data); |
| 490 | DebugTensor(const std::vector<f16_t>& data); |
| 491 | DebugTensor& operator=(const DebugTensor& other) = default; |
| 492 | float max_err(const DebugTensor& other) const; |
| 493 | |
| 494 | std::vector<float> data_f32; |
| 495 | std::vector<f16_t> data_f16; |
| 496 | DataType data_type; |
| 497 | }; |
| 498 | std::map<std::string, DebugTensor>& debug_map_cpu(); |
| 499 | void dump_debug_map(const std::string& filename); |
| 500 | void dump_debug_map_as_safetensors(const std::string& filename); |