MCPcopy Create free account
hub / github.com/pytorch/pytorch / runOpBenchmark

Function runOpBenchmark

caffe2/python/hypothesis_test_util.py:342–366  ·  view source on GitHub ↗
(
    device_option,
    op,
    inputs,
    input_device_options=None,
    iterations=10,
)

Source from the content-addressed store, hash-verified

340
341
342def runOpBenchmark(
343 device_option,
344 op,
345 inputs,
346 input_device_options=None,
347 iterations=10,
348):
349 op = copy.deepcopy(op)
350 op.device_option.CopyFrom(device_option)
351 net = caffe2_pb2.NetDef()
352 net.op.extend([op])
353 net.name = op.name if op.name else "test"
354
355 with temp_workspace():
356 _input_device_options = input_device_options or \
357 core.InferOpBlobDevicesAsDict(op)[0]
358 for (n, b) in zip(op.input, inputs):
359 workspace.FeedBlob(
360 n,
361 b,
362 device_option=_input_device_options.get(n, device_option)
363 )
364 workspace.CreateNet(net)
365 ret = workspace.BenchmarkNet(net.name, 1, iterations, True)
366 return ret
367
368
369def runOpOnInput(

Callers 3

runMethod · 0.90
runMethod · 0.90
runMethod · 0.90

Calls 3

temp_workspaceFunction · 0.85
extendMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…