| 60 | } |
| 61 | |
| 62 | std::shared_ptr<TensorBatch> TensorBatch::WrapExternalBufferVector(std::vector<py::object> buffers, |
| 63 | std::optional<nvcv::TensorLayout> layout) |
| 64 | { |
| 65 | TensorList list; |
| 66 | list.reserve(buffers.size()); |
| 67 | for (auto &obj : buffers) |
| 68 | { |
| 69 | std::shared_ptr<ExternalBuffer> buffer = cast_py_object_as<ExternalBuffer>(obj); |
| 70 | if (!buffer) |
| 71 | { |
| 72 | throw std::runtime_error("Input buffer doesn't provide cuda_array_interface or DLPack interfaces."); |
| 73 | } |
| 74 | auto tensor = Tensor::Wrap(*buffer, layout); |
| 75 | list.push_back(tensor); |
| 76 | } |
| 77 | auto batch = Create(buffers.size()); |
| 78 | batch->pushBackMany(list); |
| 79 | return batch; |
| 80 | } |
| 81 | |
| 82 | TensorBatch::TensorBatch(int capacity) |
| 83 | : m_key(capacity) |
nothing calls this directly
no test coverage detected