Skip to content

some question about list_encode? #29

@hustcxx

Description

@hustcxx

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 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions