get_acc¶
Compute top-1 classification accuracy of model on dataset.
Puts the model in eval mode for the pass and restores train mode
before returning so the caller's training loop is unaffected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Module
|
Classifier returning logits of shape |
required |
dataset
|
Dataset
|
Iterable yielding |
required |
batch_size
|
int
|
DataLoader batch size. |
128
|
device
|
str
|
Device to run evaluation on. |
'cuda'
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Scalar |