xlnstorch.benchmark.Benchmark

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:

  1. device class attribute (defaults to “cpu”)

  2. make_inputs()

  3. forward()

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)).

make_inputs()

Produce input tensors for one iteration of the benchmark.

post_forward(output)

Optional light-weight processing of the forward result.

Attributes

device