def test_graph_kws(kws_graph, kws_sounds): G = create_graph(kws_graph, opts={"load_tensors": True}) G.add_dimensions() input_tensor = import_data(kws_sounds[0], offset=0, divisor=128, nptype='int16') normal_steps = 0 fusion_steps = 0 # pylint: disable=unused-variable executer = GraphExecuter(G) for step_idx, node, fnode, output_tensors, details in\ executer.execute_iterator([input_tensor]): if fnode is not None: fusion_steps += 1 else: normal_steps += 1 assert normal_steps == 9 and fusion_steps == 0
def test_graph_calc(mnist_graph, mnist_images): G = create_graph(mnist_graph, opts={"load_tensors": True}) G.add_dimensions() input_tensor = import_data(mnist_images[0], height=28, width=28, offset=0, divisor=255) input_tensor = input_tensor.reshape((28, 28, 1)) normal_steps = 0 fusion_steps = 0 # pylint: disable=unused-variable executer = GraphExecuter(G) for step_idx, pnode, fnode, output_tensors, details in\ executer.execute_iterator([input_tensor]): if fnode is not None: fusion_steps += 1 else: normal_steps += 1 assert normal_steps == 10 and fusion_steps == 0