Convert TVM Tensors to PyTorch tensors using DLPack.
(
self, tvm_tensors: Any | list[Any]
)
| 418 | ) from error |
| 419 | |
| 420 | def _convert_tvm_to_pytorch( |
| 421 | self, tvm_tensors: Any | list[Any] |
| 422 | ) -> Union["torch.Tensor", list["torch.Tensor"]]: |
| 423 | """Convert TVM Tensors to PyTorch tensors using DLPack.""" |
| 424 | if isinstance(tvm_tensors, list | tuple): |
| 425 | return [self._convert_single_tvm_to_pytorch(tensor) for tensor in tvm_tensors] |
| 426 | return self._convert_single_tvm_to_pytorch(tvm_tensors) |
| 427 | |
| 428 | def _convert_single_tvm_to_pytorch(self, tvm_tensor: Any) -> "torch.Tensor": |
| 429 | """Convert a single TVM Tensor to PyTorch tensor using faster DLPack converter.""" |