| 464 | } |
| 465 | |
| 466 | void BuildRestoreSlice( |
| 467 | const std::vector<TensorSliceProto>& table_slices, |
| 468 | int64 slice_beg, int64 slice_length, |
| 469 | std::vector<RestoreHashTableSlice>* out_slices) { |
| 470 | int64 kBlock = 1 << 20; |
| 471 | for (size_t i = 0; i < table_slices.size(); i++) { |
| 472 | if (table_slices[i].hash_slice_begin() >= slice_beg + slice_length || |
| 473 | slice_beg >= table_slices[i].hash_slice_begin() + |
| 474 | table_slices[i].hash_slice_length()) { |
| 475 | continue; |
| 476 | } |
| 477 | int64 idx = table_slices[i].extent(0).length(); |
| 478 | for (int64 j = 0; j < idx; j += kBlock) { |
| 479 | int64 len = std::min(idx - j, kBlock); |
| 480 | out_slices->emplace_back(); |
| 481 | out_slices->back().slice_id = i; |
| 482 | out_slices->back().beg = j; |
| 483 | out_slices->back().len = len; |
| 484 | } |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | Status InsertTable( |
| 489 | BundleReader* reader, HashTable* table, |
no test coverage detected