Skip to content

Commit

Permalink
[Relay] clean up hd, change tl (apache#2917)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarisaKirisame authored and wweic committed Mar 29, 2019
1 parent 9f01aba commit 41c3e81
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions python/tvm/relay/prelude.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def define_list_hd(self):
x = Var("x", self.l(a))
y = Var("y")
z = Var("z")
# Don't match nil() since it will break type checking
cons_case = Clause(PatternConstructor(self.cons, [PatternVar(y), PatternVar(z)]), y)
self.mod[self.hd] = Function([x], Match(x, [cons_case]), a, [a])

Expand All @@ -43,9 +42,8 @@ def define_list_tl(self):
x = Var("x", self.l(a))
y = Var("y")
z = Var("z")
nil_case = Clause(PatternConstructor(self.nil, []), self.nil())
cons_case = Clause(PatternConstructor(self.cons, [PatternVar(y), PatternVar(z)]), z)
self.mod[self.tl] = Function([x], Match(x, [nil_case, cons_case]), self.l(a), [a])
self.mod[self.tl] = Function([x], Match(x, [cons_case]), self.l(a), [a])

def define_list_nth(self):
"""Defines a function to get the nth element of a list.
Expand Down

0 comments on commit 41c3e81

Please sign in to comment.