Solved by Mona_Jalal in post #2 
              
              
                Please let me know if this answer makes sense 
landmarks_arr = []


for i in range(len(train_dataset)):
    landmarks = to_tensor(train_dataset[i]['landmarks'])
    landmarks[landmarks != landmarks] = 0  # this will set all nan to zero
    landmarks_arr.append(landmarks)
    
mean = torch.mean(torch…