dasikuzi2 opened a new issue, #267:
URL: https://github.com/apache/tvm-ffi/issues/267
When calling an FFI-wrapped C++ kernel from the upper-level PyTorch
framework, the passed argument may be either None or a tensor. How should I
declare the input parameter in the C++ interface to ensure the kernel executes
correctly?
Below is my current approach and the resulting error:
I declare the parameter in the C++ interface as:
`tvm::ffi::Optional<TensorView> a;`
However, when PyTorch passes None for this argument, it triggers an error
inside the TensorView constructor:
```
TensorView(const DLTensor* tensor) { // NOLINT(*)
TVM_FFI_ICHECK(tensor != nullptr);
tensor_ = *tensor;
}
```
The check TVM_FFI_ICHECK(tensor != nullptr) fails because None from Python
is converted to a nullptr DLTensor, which is not allowed by the TensorView
constructor.
So, how can I design my FFI C++ interface to accept a parameter that might
be either None or a valid tensor?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]