marcman411:

at::tensor my_func(at::Tensor t) { // some operation changing the data in t }


Please pass by reference
i.e.
at::tensor my_func(at::Tensor &t)
{
    // some operation changing the data in t
}