GraphWriter icon indicating copy to clipboard operation
GraphWriter copied to clipboard

some question about list_encode?

Open hustcxx opened this issue 3 years ago • 2 comments

def forward(self,batch,pad=True): batch,phlens,batch_lens = batch batch_lens = tuple(batch_lens.tolist())#list-to-tuple _,enc = self.seqenc((batch,phlens)) enc = enc[:,2:] enc = torch.cat([enc[:,i] for i in range(enc.size(1))],1) m = max(batch_lens) encs = [self.pad(x,m) for x in enc.split(batch_lens)] out = torch.stack(encs,0) return out i don't understand why use enc = enc[:,2:] and enc = torch.cat([enc[:,i] for i in range(enc.size(1))],1)??? anybody can explain to me?thanks .

hustcxx avatar Apr 08 '21 07:04 hustcxx