MCPcopy Create free account
hub / github.com/pytorch/tutorials / benchmark

Function benchmark

intermediate_source/torch_compile_conv_bn_fuser.py:264–271  ·  view source on GitHub ↗
(model, iters=20)

Source from the content-addressed store, hash-verified

262output = rn18(inp)
263
264def benchmark(model, iters=20):
265 with torch.no_grad():
266 for _ in range(10):
267 model(inp)
268 begin = time.time()
269 for _ in range(iters):
270 model(inp)
271 return str(time.time()-begin)
272
273# Benchmark original model
274print("Original model time: ", benchmark(rn18))

Callers 1

Calls 1

modelFunction · 0.50

Tested by

no test coverage detected