Skip to content

Commit

Permalink
Update lenet.md (d2l-ai#457)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanwenlei authored and astonzhang committed Dec 25, 2018
1 parent 7df2501 commit b7cf0d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions chapter_convolutional-neural-networks/lenet.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ train_iter, test_iter = gb.load_data_fashion_mnist(batch_size=batch_size)
因为卷积神经网络计算比多层感知机要复杂,建议使用GPU来加速计算。我们尝试在`gpu(0)`上创建NDArray,如果成功则使用`gpu(0)`,否则仍然使用CPU。

```{.python .input}
def try_gpu4(): # 本函数已保存在 gluonbook 包中方便以后使用。
def try_gpu(): # 本函数已保存在 gluonbook 包中方便以后使用。
try:
ctx = mx.gpu()
_ = nd.zeros((1,), ctx=ctx)
except mx.base.MXNetError:
ctx = mx.cpu()
return ctx
ctx = try_gpu4()
ctx = try_gpu()
ctx
```

Expand Down

0 comments on commit b7cf0d0

Please sign in to comment.