MCPcopy
hub / github.com/karpathy/makemore / encode

Method encode

makemore.py:527–529  ·  view source on GitHub ↗
(self, word)

Source from the content-addressed store, hash-verified

525 return self.max_word_length + 1 # <START> token followed by words
526
527 def encode(self, word):
528 ix = torch.tensor([self.stoi[w] for w in word], dtype=torch.long)
529 return ix
530
531 def decode(self, ix):
532 word = ''.join(self.itos[i] for i in ix)

Callers 1

__getitem__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected