| 386 | stack_.back().items.push_back(std::move(value)); |
| 387 | } |
| 388 | void op_setitems() { |
| 389 | const size_t mark = pop_mark(); |
| 390 | std::vector<PickleValue> items(stack_.begin() + static_cast<std::ptrdiff_t>(mark), stack_.end()); |
| 391 | stack_.erase(stack_.begin() + static_cast<std::ptrdiff_t>(mark), stack_.end()); |
| 392 | if (stack_.empty() || stack_.back().kind != PickleValue::Kind::Dict) { |
| 393 | throw std::runtime_error("torch .bin pickle setitems without a dict"); |
| 394 | } |
| 395 | for (auto & item : items) { |
| 396 | stack_.back().items.push_back(std::move(item)); |
| 397 | } |
| 398 | } |
| 399 | std::vector<PickleValue> finish() { |
| 400 | const PickleValue result = pop(); |
| 401 | if (result.kind != PickleValue::Kind::Dict) { |