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
示例#2
0
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)
示例#3
0
def roundtrip(expr):
    x = relay.fromtext(expr.astext())
    assert_graph_equal(x, expr)