From 62914adef820cb424caad297dd59d839dde537a2 Mon Sep 17 00:00:00 2001 From: xiaotinghe Date: Sat, 27 Nov 2021 15:33:00 +0800 Subject: [PATCH] fix d2lbook build (#1012) Co-authored-by: Ubuntu --- chapter_computer-vision/kaggle-dog.md | 2 +- chapter_deep-learning-computation/deferred-init.md | 4 ++++ .../subword-embedding.md | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/chapter_computer-vision/kaggle-dog.md b/chapter_computer-vision/kaggle-dog.md index 893b9b7f..33037dab 100644 --- a/chapter_computer-vision/kaggle-dog.md +++ b/chapter_computer-vision/kaggle-dog.md @@ -275,7 +275,7 @@ def evaluate_loss(data_iter, net, devices): l = loss(outputs, labels) l_sum += l.sum() n += labels.numel() - return l_sum / n + return (l_sum / n).to('cpu') ``` ## 定义[**训练函数**] diff --git a/chapter_deep-learning-computation/deferred-init.md b/chapter_deep-learning-computation/deferred-init.md index 3f3706fd..6f82b40b 100644 --- a/chapter_deep-learning-computation/deferred-init.md +++ b/chapter_deep-learning-computation/deferred-init.md @@ -120,6 +120,10 @@ net(X) [Discussions](https://discuss.d2l.ai/t/1834) :end_tab: +:begin_tab:`pytorch` +[Discussions](https://discuss.d2l.ai/t/1834) +:end_tab: + :begin_tab:`tensorflow` [Discussions](https://discuss.d2l.ai/t/1833) :end_tab: diff --git a/chapter_natural-language-processing-pretraining/subword-embedding.md b/chapter_natural-language-processing-pretraining/subword-embedding.md index 5beee465..71e8a1e8 100644 --- a/chapter_natural-language-processing-pretraining/subword-embedding.md +++ b/chapter_natural-language-processing-pretraining/subword-embedding.md @@ -144,3 +144,7 @@ print(segment_BPE(tokens, symbols)) :begin_tab:`mxnet` [Discussions](https://discuss.d2l.ai/t/386) :end_tab: + +:begin_tab:`pytorch` +[Discussions](https://discuss.d2l.ai/t/386) +:end_tab: \ No newline at end of file -- GitLab