| 278 | } |
| 279 | |
| 280 | bool TensorResponse::ParseSlow(Source* source) { |
| 281 | if (!meta_.ParseFromZeroCopyStream(source->contents())) { |
| 282 | return false; |
| 283 | } |
| 284 | |
| 285 | Tensor parsed(meta_.tensor().dtype()); |
| 286 | if (!parsed.FromProto(allocator_, meta_.tensor())) { |
| 287 | return false; |
| 288 | } |
| 289 | tensor_ = std::move(parsed); |
| 290 | |
| 291 | // Reduce memory usage for big tensors. |
| 292 | { |
| 293 | TensorProto empty; |
| 294 | meta_.mutable_tensor()->Swap(&empty); |
| 295 | } |
| 296 | meta_.clear_tensor(); |
| 297 | |
| 298 | return true; |
| 299 | } |
| 300 | |
| 301 | void FuseTensorResponse::InitAlloc(DeviceBase* d, |
| 302 | const AllocatorAttributes& aa) { |