def do_convert_to_aterm(context, graph): """Convert the graph to an ATerm graph See blaze/expr/paterm.py :: a + b :: Arithmetic( Add , Array(){dshape("3, int64"), 45340864} , Array(){dshape("3, int64"), 45340864} ){dshape("3, int64"), 45264432} """ context = dict(context) vars = topovals(graph) visitor = BlazeVisitor() aterm_graph = visitor.visit(graph) operands = visitor.operands # ---------------------- context['operands'] = operands context['aterm_graph'] = aterm_graph # TODO: remove context['output'] = aterm_graph # ---------------------- return context, graph
def do_convert_to_aterm(context, graph): """Convert the graph to an ATerm graph See blaze.aterm :: a + b """ context = dict(context) vars = topovals(graph) # walk the blaze Graph objects ( Python objects inherting # derived expr.node.Node ) map them into a ATerm expression visitor = BlazeVisitor() aterm_graph = visitor.visit(graph) operands = visitor.operands # ---------------------- context['operands'] = operands context['aterm_graph'] = aterm_graph # ---------------------- return context, graph