未验证 提交 afeb2372 编写于 作者: A Anirudh Dagar 提交者: GitHub

Fix: Epoch instead of batch (#1025)

* Fix: Epoch instead of batch

* Epoch -> epoch
上级 8c1b1436
......@@ -207,7 +207,7 @@ for i in range(10):
# 迭代卷积核
conv2d.weight.data()[:] -= lr * conv2d.weight.grad()
if (i + 1) % 2 == 0:
print(f'batch {i+1}, loss {float(l.sum()):.3f}')
print(f'epoch {i+1}, loss {float(l.sum()):.3f}')
```
```{.python .input}
......@@ -229,7 +229,7 @@ for i in range(10):
# 迭代卷积核
conv2d.weight.data[:] -= lr * conv2d.weight.grad
if (i + 1) % 2 == 0:
print(f'batch {i+1}, loss {l.sum():.3f}')
print(f'epoch {i+1}, loss {l.sum():.3f}')
```
```{.python .input}
......@@ -255,7 +255,7 @@ for i in range(10):
weights[0] = conv2d.weights[0] - update
conv2d.set_weights(weights)
if (i + 1) % 2 == 0:
print(f'batch {i+1}, loss {tf.reduce_sum(l):.3f}')
print(f'epoch {i+1}, loss {tf.reduce_sum(l):.3f}')
```
在$10$次迭代之后,误差已经降到足够低。现在我们来看看我们[**所学的卷积核的权重张量**]。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册