def astext(p, unify_free_vars=False): txt = p.astext() if isinstance(p, Expr) and free_vars(p): return txt x = relay.fromtext(txt) if unify_free_vars: assert_graph_equal(x, p) else: assert_alpha_equal(x, p) return txt
def check_visit(typ): try: ef = TypeFunctor() ef.visit(typ) assert False except NotImplementedError: pass ev = TypeVisitor() ev.visit(typ) assert_graph_equal(TypeMutator().visit(typ), typ)
def roundtrip(expr): x = relay.fromtext(expr.astext()) assert_graph_equal(x, expr)