| 131 | int64_t storage_offset = 0; // Tensor start inside its storage, in elements |
| 132 | int64_t numel = 0; // Storage/Tensor element count |
| 133 | }; |
| 134 | |
| 135 | GlobalKind classify_global(const std::string & module, const std::string & name) { |
| 136 | if (module == "collections" && name == "OrderedDict") { |
| 137 | return GlobalKind::OrderedDict; |
| 138 | } |
| 139 | if (module == "torch._utils" && name == "_rebuild_tensor_v2") { |
| 140 | return GlobalKind::RebuildTensor; |
| 141 | } |
| 142 | if (module == "torch" && name == "FloatStorage") { |
| 143 | return GlobalKind::StorageF32; |
| 144 | } |
| 145 | if (module == "torch" && name == "HalfStorage") { |
| 146 | return GlobalKind::StorageF16; |
| 147 | } |
| 148 | if (module == "torch" && name == "BFloat16Storage") { |
| 149 | return GlobalKind::StorageBF16; |
| 150 | } |
| 151 | throw std::runtime_error("torch .bin pickle references an unsupported global: " + module + "." + name); |
| 152 | } |
| 153 |
no outgoing calls
no test coverage detected