For a project I am working on, I require passing a PyTorch tensor (with dtype torch.int16) to a C++ method which expects an std::vector (basically, a list of integers).
I have the binding figured out, and I am already able to accomplish this task if I first convert my tensor into a numpy array (and use pybind11's numpy support), but for optimizing my code I want to be able to do this without this conversion to a numpy array.
Based on my research, I assume that I will have to write a custom type-caster. How should I proceed?