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

Function f

caffe2/python/benchmarks/sparse_normalize_benchmark.py:33–40  ·  view source on GitHub ↗
(_, outputs)

Source from the content-addressed store, hash-verified

31 # In order to produce truly random lengths and indices, we will embed a
32 # Python operator in the net to generate them.
33 def f(_, outputs):
34 lengths = np.random.randint(
35 int(average_len * 0.75), int(average_len * 1.25), batch_size
36 ).astype(np.int32)
37 indices = np.random.randint(0, categorical_limit, np.sum(lengths)).astype(
38 np.int64
39 )
40 outputs[0].feed(indices)
41
42 workspace.FeedBlob("X", data)
43 workspace.FeedBlob("huge_blob", np.random.randn(l3_cache_size).astype(np.float32))

Callers 2

funcFunction · 0.50
_ForEachDeviceFunction · 0.50

Calls 3

astypeMethod · 0.80
randintMethod · 0.80
sumMethod · 0.45

Tested by

no test coverage detected