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

Function targetTensor

intermediate_source/char_rnn_generation_tutorial.py:243–246  ·  view source on GitHub ↗
(line)

Source from the content-addressed store, hash-verified

241
242# ``LongTensor`` of second letter to end (EOS) for target
243def targetTensor(line):
244 letter_indexes = [all_letters.find(line[li]) for li in range(1, len(line))]
245 letter_indexes.append(n_letters - 1) # EOS
246 return torch.LongTensor(letter_indexes)
247
248
249######################################################################

Callers 1

randomTrainingExampleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected