| 268 | */ |
| 269 | template <typename Backend> |
| 270 | std::vector<DLMTensorPtr> GetDLTensorListView(TensorList<Backend> &tensor_list) { |
| 271 | int device_id = tensor_list.device_id(); |
| 272 | bool pinned = tensor_list.is_pinned(); |
| 273 | |
| 274 | std::vector<DLMTensorPtr> dl_tensors{}; |
| 275 | dl_tensors.reserve(tensor_list.num_samples()); |
| 276 | |
| 277 | for (int i = 0; i < tensor_list.num_samples(); ++i) |
| 278 | dl_tensors.push_back(GetDLTensorView(tensor_list[i], pinned, device_id)); |
| 279 | return dl_tensors; |
| 280 | } |
| 281 | |
| 282 | |
| 283 | /** Gets a DLManagedTensor which shares the buffer ownership with a tensor. |