def test_print_graph(): g = Graph() g.debug.name = "testfn" p = g.add_parameter() p.debug.name = "a" p2 = g.add_parameter() p2.debug.name = "b" c = g.constant(1) g.output = g.apply(g, c, p2) g.output.debug.name = "_apply0" s = print_graph(g) assert (s == """graph testfn(%a, %b) { %_apply0 = @testfn(1, %b) return %_apply0 } """) # We use fake types here because we only care about the printing logic, # not the proper use of types. p.abstract = "int64" p2.abstract = "float32" g.output.abstract = "bool" g.return_.abstract = "bool" s = print_graph(g) assert (s == """graph testfn(%a : int64, %b : float32) -> bool { %_apply0 = @testfn(1, %b) ; type=bool return %_apply0 } """)
def test_print_node(): g = Graph() g.debug.name = "testfn" p = g.add_parameter() p.debug.name = "a" p2 = g.add_parameter() p2.debug.name = "b" c = g.constant(1) g.output = g.apply(g, c, p2) g.output.debug.name = "_apply0" s = print_node(g.output) assert s == "%_apply0 = @testfn(1, %b)\n"
def test_print_graph(): g = Graph() g.debug.name = 'testfn' p = g.add_parameter() p.debug.name = 'a' p2 = g.add_parameter() p2.debug.name = 'b' c = g.constant(1) g.output = g.apply(g, c, p2) g.output.debug.name = '_apply0' s = print_graph(g) assert s == """graph testfn(%a, %b) {
def test_print_graph(): g = Graph() g.debug.name = "testfn" p = g.add_parameter() p.debug.name = "a" p2 = g.add_parameter() p2.debug.name = "b" c = g.constant(1) g.output = g.apply(g, c, p2) g.output.debug.name = "_apply0" s = print_graph(g) assert (s == """graph testfn(%a, %b) { %_apply0 = @testfn(1, %b) return %_apply0 } """)