Deep-Semantic-Similarity-Model-PyTorch icon indicating copy to clipboard operation
Deep-Semantic-Similarity-Model-PyTorch copied to clipboard

transpose does not work

Open jwc19890114 opened this issue 5 years ago • 1 comments

hi, it is obsession me that the l_Qs[i].transpose(1,2) when i test this method, i found that this method does not work

import torch
from torch.autograd import Variable
import numpy as np

q=np.random.rand(1,6,300)
q=Variable(torch.from_numpy(q).float())
print(q.size())
q.transpose(1,2)
print(q.size())
torch.Size([1, 6, 300])
torch.Size([1, 6, 300])

jwc19890114 avatar Jan 30 '20 08:01 jwc19890114

you have to change: q.transpose(1,2) to q = q.transpose(1,2)

nishnik avatar Jan 30 '20 15:01 nishnik