xnn.common.deploy.graphed_eval.GraphedEvaluation#
- class xnn.common.deploy.graphed_eval.GraphedEvaluation(model, margin=1.05, slack=64, warmup=2, trial=3, max_ms=100.0)[source]#
Bases:
objectA model’s evaluations on padded graphs, captured once per size class and replayed.
- Parameters:
model (torch.nn.Module) – The evaluation,
model(graph) -> dict(for example aForceStressOutput), on a CUDA device; it or one of its submodules must provideindex_planner().margin (float, optional) – Relative headroom of the atom, edge and plan counts over the first input (and over an input that outgrows them), by default 1.05: in molecular dynamics the edge count drifts by a few percent, and every padding edge costs as much as a real one.
slack (int, optional) – Absolute headroom added to the counts, by default 64.
warmup (int, optional) – Ordinary evaluations before the capture, by default 2. They and the capture run with TorchScript fusion off, so that no TorchScript block compiles a kernel while it is recorded.
trial (int, optional) – Replays and ordinary evaluations timed against each other after a capture, by default 3; the faster is used until the input outgrows the counts.
0always replays.max_ms (float or None, optional) – Wall time in milliseconds of an ordinary evaluation of the first input above which nothing is captured and evaluations stay ordinary, by default 100: the launches are a small part of such an evaluation, and a graph’s memory would come on top of its own. The first calls are ordinary evaluations, timed, until one takes at most
max_msorPROBESof them took longer.Nonecaptures whatever the time, from the first call.
- Raises:
ValueError – If the model has no index planner.