Skip to content

Commit

Permalink
Frontend WIP (apache#47)
Browse files Browse the repository at this point in the history
* incorporate changes

* incorporate changes

* incorporate changes

* incorporate changes

* incorporate changes

* incorporate changes

* parse keyword arguments

* improves BoolLitNode pretty printing
  • Loading branch information
joshpoll authored and jroesch committed Aug 16, 2018
1 parent 6a92c76 commit c2f3d78
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 3 additions & 5 deletions relay/python/relay/relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ def visit_Call(self, call_node):
"""Transform a Python call into a Relay call"""
func = call_node.func
args = call_node.args
# keywords = call_node.keywords

keywords = call_node.keywords
if isinstance(func, ast.Attribute):
if func.value.id == 'relay':
relay_func = IntrinsicId(func.attr)
Expand All @@ -151,13 +150,12 @@ def visit_Call(self, call_node):
"only supported namespace is relay right now") # improve me
else:
raise Exception("unsupported calls")

# TODO(joshpoll): Handle args
relay_args = [self.visit(arg) for arg in args]

# relay_kwds = {LocalId(kwd.arg): self.visit(kwd.value) for kwd in keywords}
relay_attrs = Attributes({LocalId(kwd.arg): self.visit(kwd.value) for kwd in keywords})

return Call(relay_func, relay_args)
return Call(relay_func, relay_args, relay_attrs)

def visit_Assign(self, assign_node):
targets = assign_node.targets
Expand Down
3 changes: 2 additions & 1 deletion relay/src/relay/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ TVM_REGISTER_API("nnvm.make.BoolLit")

TVM_STATIC_IR_FUNCTOR_REGISTER(IRPrinter, vtable)
.set_dispatch<BoolLitNode>([](const BoolLitNode *node, tvm::IRPrinter *p) {
p->stream << "BoolLitNode(" << node->value << ")";
std::string pybool = (node->value == 0) ? "False" : "True";
p->stream << "BoolLitNode(" << pybool << ")";
});

TensorLit TensorLitNode::make(tvm::Array<Expr> value) {
Expand Down

0 comments on commit c2f3d78

Please sign in to comment.