mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-06-24 02:14:17 +00:00
Quickstart: Use tensors to compute train accuracy (#1662)
Co-authored-by: Dave Farago <dfarago@innoopract.com>
This commit is contained in:
parent
d37d092c14
commit
29adae84eb
1 changed files with 2 additions and 2 deletions
|
|
@ -205,11 +205,11 @@ for step in range(1000):
|
|||
opt.step()
|
||||
|
||||
# calculate accuracy
|
||||
pred = out.argmax(axis=-1).numpy()
|
||||
pred = out.argmax(axis=-1)
|
||||
acc = (pred == labels).mean()
|
||||
|
||||
if step % 100 == 0:
|
||||
print(f"Step {step+1} | Loss: {loss.numpy()} | Accuracy: {acc}")
|
||||
print(f"Step {step+1} | Loss: {loss.numpy()} | Accuracy: {acc.numpy()}")
|
||||
```
|
||||
|
||||
## Evaluation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue