Mmm, I guess you can exploit same approach, as I did: create some PyTorch tensors beforehand (using Python’s C API, for example), grab theirs data_ptr’s and use them to pass data between Python and C. You need to know exact dimensions, strides and types of tensors if you plan to use it with C APIs.