Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit

Permalink
Update tensor indexing (d2l-ai#2339)
Browse files Browse the repository at this point in the history
* Update tensor indexing

* Update chapter_recurrent-neural-networks/language-model.md

* Update chapter_recurrent-neural-networks/language-model.md

Co-authored-by: Aston Zhang <22279212+astonzhang@users.noreply.github.com>
  • Loading branch information
gab-chen and astonzhang authored Nov 20, 2022
1 parent 9b1c0b7 commit 82b3728
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion chapter_recurrent-neural-networks/language-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def __init__(self, batch_size, num_steps, num_train=10000, num_val=5000):
self.save_hyperparameters()
corpus, self.vocab = self.build(self._download())
array = d2l.tensor([corpus[i:i+num_steps+1]
for i in range(0, len(corpus)-num_steps-1)])
for i in range(len(corpus)-num_steps)])
self.X, self.Y = array[:,:-1], array[:,1:]
```

Expand Down

0 comments on commit 82b3728

Please sign in to comment.