I am also wondering how is it possible to do this.
I was thinking about creating a strcuture like
typedef struct
{	
  at::Tensor index;
	at::Tensor mask;
} Ret;

and then define the function as
Ret *function(args)

instead of
at::Tensor function(args)

I wish to use this c++ implementation with a python wrapper for pytorch. How can I reflect this modification at::Tensor to Ret * in PyTorch implementation?