general pattern is torch.mul(m,v,out=r), there should be a function with similar signature in c++
that’s about preallocation, I don’t think aliasing per se plays any role like in Eigen, as you’re using higher level wrappers with reference semantics. In particular, inplace ops are explicit (m.mul_(v)) as you’d run into autograd errors otherwise.