pytorch/ignite

Provide tiny wrapper over pytorch ThroughputBenchmark

Open

#843 aberto em 19 de mar. de 2020

Ver no GitHub
 (12 comments) (0 reactions) (0 assignees)Python (602 forks)batch import
enhancementhelp wanted

Métricas do repositório

Stars
 (4.313 stars)
Métricas de merge de PR
 (Mesclagem média 18d 23h) (19 fundiu PRs em 30d)

Description

🚀 Feature

PyTorch utils module provides ThroughputBenchmark since 1.2.0

 >>> from torch.utils import ThroughputBenchmark
>>> bench = ThroughputBenchmark(my_module)
>>> # Pre-populate benchmark's data set with the inputs
>>> for input in inputs:
    # Both args and kwargs work, same as any PyTorch Module / ScriptModule
    bench.add_input(input[0], x2=input[1])
>>> # Inputs supplied above are randomly used during the execution
>>> stats = bench.benchmark(
                num_calling_threads=4,
                num_warmup_iters = 100,
                num_iters = 1000,
            )
>>> print("Avg latency (ms): {}".format(stats.latency_avg_ms))
>>> print("Number of iterations: {}".format(stats.num_iters))

It would be interesting to provide a tiny wrapper over this to simplify usage with ignite.

Guia do colaborador