closes #80
This commit is contained in:
Benoit Chevallier-Mames
2021-08-04 18:13:15 +02:00
committed by Benoit Chevallier
parent 1ee8195af0
commit 1771bc6e52
2 changed files with 4 additions and 4 deletions

View File

@@ -30,10 +30,6 @@ class OPGraph:
if len(self.graph.pred[node]) == 0 and isinstance(node, ir.Input)
}
graph_outputs = set(node for node in self.graph.nodes() if len(self.graph.succ[node]) == 0)
assert set(self.output_nodes.values()) == graph_outputs
def evaluate(self, inputs: Mapping[int, Any]) -> Dict[ir.IntermediateNode, Any]:
"""Function to evaluate a graph and get intermediate values for all nodes

View File

@@ -58,6 +58,10 @@ from hdk.hnumpy import tracing
lambda x, y: (y, x),
"\n%0 = y\n%1 = x\nreturn(%0, %1)",
),
(
lambda x, y: (x, x + 1),
"\n%0 = x\n%1 = ConstantInput(1)\n%2 = Add(0, 1)\nreturn(%0, %2)",
),
],
)
@pytest.mark.parametrize(