xlnstorch.benchmark.Benchmark#
- class xlnstorch.benchmark.Benchmark#
Base-class that users should inherit from in order to create benchmarks.
Only 3 hooks are strictly required to be implemented:
deviceclass attribute (defaults to “cpu”)
Optional hooks allow for custom book-keeping around each iteration / epoch as well as post-processing of the forward result.
- __init__()#
Methods
__init__()after_epoch(idx)Symmetric counterpart of
before_epoch().before_epoch(idx)Called before the idx-th epoch.
forward(*args, **kwargs)The workload under test (e.g.
model(*args, **kwargs)).Produce input tensors for one iteration of the benchmark.
post_forward(output)Optional light-weight processing of the forward result.
Attributes
device