pytorch/ignite

Provide tiny wrapper over pytorch ThroughputBenchmark

Open

#843 建立於 2020年3月19日

在 GitHub 查看
 (12 留言) (0 反應) (0 負責人)Python (602 fork)batch import
enhancementhelp wanted

倉庫指標

Star
 (4,313 star)
PR 合併指標
 (平均合併 18天 23小時) (30 天內合併 19 個 PR)

描述

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

貢獻者指南