I looked into the above code once more and found out that torch::reshape can be replaced by view(...). The above two code snippets then look as follows:
return torch::stack( { base[k], base[k+1] } ).view( {1,2} );

and
torch::Tensor zero = torch::zeros(1);
return torch::stack( { base[k], base[k+1], zero[0], 
                       zero[0], base[k+2], base[k+3] } ).view( {2,3} );