ATen c++ tensors through a C-api

I can use the various TH/THC routines with a C-api by passing a void pointer,
e.g.
THFloatTensor *t=THFloatTensor_new();
THFloatTensor_resizeNd(t, dim, sizes);
void *v=t;

but I can’t figure out how to pass a pointer back and forth with the higher-level ATen Tensor,
e.g.
Tensor t=CPU(kFloat).ones({3, 4});
void *p=&t;

either this is incorrect, or my tensor is out of scope so that i can no longer reference it on the other side of the C-api, or I need to increment it’s reference or…?

Thanks

You can just pass the Tensor around.

Thanks for the reply.

My setup:
ATen c++ <–> C-api <–> kdb+ interpreter

I don’t think I can pass a Tensor object through this setup,
just a pointer.
I was able to do something like this:

auto t=new Tensor(CPU(kFloat).tensor(size));

this pointer can be sent back and forth,
and needs to be free’d later with

delete t;