| 324 | } |
| 325 | |
| 326 | int64 GetAllocatedBytes(const std::vector<Tensor>& element) { |
| 327 | int64 allocated_bytes = 0; |
| 328 | DatasetBase* dataset; |
| 329 | for (auto& tensor : element) { |
| 330 | if (tensor.dtype() == DT_VARIANT && |
| 331 | GetDatasetFromVariantTensor(tensor, &dataset).ok()) { |
| 332 | allocated_bytes += dataset->AllocatedBytes(); |
| 333 | } else { |
| 334 | allocated_bytes += tensor.AllocatedBytes(); |
| 335 | } |
| 336 | } |
| 337 | return allocated_bytes; |
| 338 | } |
| 339 | |
| 340 | Status GetDatasetFromVariantTensor(const Tensor& tensor, |
| 341 | DatasetBase** out_dataset) { |
no test coverage detected