MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / build_graph

Function build_graph

tensorflow/python/ops/split_benchmark.py:34–52  ·  view source on GitHub ↗

Build a graph containing a sequence of split operations. Args: device: string, the device to run on. input_shape: shape of the input tensor. output_sizes: size of each output along axis. axis: axis to be split along. Returns: An array of tensors to run()

(device, input_shape, output_sizes, axis)

Source from the content-addressed store, hash-verified

32
33
34def build_graph(device, input_shape, output_sizes, axis):
35 """Build a graph containing a sequence of split operations.
36
37 Args:
38 device: string, the device to run on.
39 input_shape: shape of the input tensor.
40 output_sizes: size of each output along axis.
41 axis: axis to be split along.
42
43 Returns:
44 An array of tensors to run()
45 """
46 with ops.device("/%s:0" % device):
47 inp = array_ops.zeros(input_shape)
48
49 outputs = []
50 for _ in range(100):
51 outputs.extend(array_ops.split(inp, output_sizes, axis))
52 return control_flow_ops.group(*outputs)
53
54
55class SplitBenchmark(test.Benchmark):

Callers 6

_run_graphMethod · 0.70
run_testMethod · 0.50
write_graphFunction · 0.50

Calls 5

rangeFunction · 0.70
deviceMethod · 0.45
extendMethod · 0.45
splitMethod · 0.45
groupMethod · 0.45

Tested by 5

run_testMethod · 0.40
write_graphFunction · 0.40