Solved by Nanachi in post #2 
              
              
                Question closed, it is not neccessary to diag a vector to a diagonal matrix, you can achieve element-wise multiply simply by using mul() 
and torch will broadcast for you. 
e.g. 
a=[8, 1, 400] 
b=[50, 400] 
just use a.mul(b) 
ans is [8, 50, 400]