MCPcopy Create free account
hub / github.com/pytorch/tutorials / prepare_sequence

Function prepare_sequence

beginner_source/nlp/sequence_models_tutorial.py:126–128  ·  view source on GitHub ↗
(seq, to_ix)

Source from the content-addressed store, hash-verified

124# Prepare data:
125
126def prepare_sequence(seq, to_ix):
127 idxs = [to_ix[w] for w in seq]
128 return torch.tensor(idxs, dtype=torch.long)
129
130
131training_data = [

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected