Hi,



 rfelixmg:

If there is any other way to get only the triu elements as a vector it would be perfect.


Would
mytriu = Variable(torch.triu(torch.randn(5,5)))
idx = torch.nonzero(torch.triu(torch.ones(*mytriu.size())).view(-1)).view(-1)
mytriu_as_vec = vec = mytriu.view(-1)[idx]

work for you?
Best regards
Thomas