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

Method run

caffe2/experiments/python/device_reduce_sum_bench.py:92–105  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

90
91class SoftMaxWithLoss(Benchmark):
92 def run(self):
93 op = core.CreateOperator(
94 "SoftmaxWithLoss",
95 ["X", "label"],
96 ["probs", "avgloss"],
97 )
98
99 for n in itertools.imap(pow, itertools.cycle([10]), range(8)):
100 for D in itertools.imap(pow, itertools.cycle([10]), range(3)):
101 X = np.random.rand(n, D).astype(np.float32)
102 label = (np.random.rand(n) * D).astype(np.int32)
103 logger.info('Running benchmark for n = {}, D= {}'.format(n, D))
104 ret = runOpBenchmark(gpu_do, op, inputs=[X, label])
105 self.results.append(((n, D), ret[1]))
106
107
108def parse_args():

Callers

nothing calls this directly

Calls 7

runOpBenchmarkFunction · 0.90
astypeMethod · 0.80
infoMethod · 0.80
rangeFunction · 0.50
randMethod · 0.45
formatMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected