Skip to content

Commit 41948d4

Browse files
MarisaKirisameWei Chen
authored andcommitted
[Relay] clean up hd, change tl (apache#2917)
1 parent a879673 commit 41948d4

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

python/tvm/relay/prelude.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def define_list_hd(self):
2929
x = Var("x", self.l(a))
3030
y = Var("y")
3131
z = Var("z")
32-
# Don't match nil() since it will break type checking
3332
cons_case = Clause(PatternConstructor(self.cons, [PatternVar(y), PatternVar(z)]), y)
3433
self.mod[self.hd] = Function([x], Match(x, [cons_case]), a, [a])
3534

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

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

0 commit comments

Comments
 (0)