Pytorch specific operation for the finding dimension wise mean for a list of tensors
I have a list of tensors, each of 300x1 dimensions and I need to find the mean and variance for each dimension based on the list. How exactly this be achieved?. I could make this work in numpy with numpy arrays, with the following code snippet:

for item in embeddingLists:    # embeddingLists is a list of lists
                               # item contains list of numpy arrays
    tempVal =  np.mean(np.array(item),axis=0)
    meanVects.append(tempVal)

    temVar = np.var(np.array(item),axis=0,ddof=1) 
    varVects.append(temVar)


With some help from pytorch discussion forum, I could solve the problem. Link to discussion

The relevant code is:

for item in embeddingLists:       
    tempItem = [stuff.unsqueeze(0)  for stuff in item] #convert a 1x300 tensor
    coomn = torch.cat(tempItem)     # Convert to a 12x300 tensor        
    temMean = torch.mean(coomn,dim=0)
    meanVects.append(temMean)
    temVar = torch.var(coomn,dim=0)
    varVects.append(temVar)

