Skip to content

Commit

Permalink
Improve style
Browse files Browse the repository at this point in the history
  • Loading branch information
wweic committed Nov 9, 2019
1 parent 4c6ec7d commit a581dc8
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions python/tvm/relay/frontend/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,14 +453,11 @@ def get_name(node):

def infer_type(node, mod=None):
"""A method to infer the type of an intermediate node in the relay graph."""
if isinstance(mod, _module.Module):
mod["main"] = _expr.Function([], node)
mod = _transform.InferType()(mod)
entry = mod["main"]
return entry.body
mod = _module.Module.from_expr(node)
mod = _transform.InferType()(mod)
entry = mod["main"]
new_mod = _module.Module.from_expr(node)
if mod is not None:
new_mod.update(mod)
new_mod = _transform.InferType()(new_mod)
entry = new_mod["main"]
return entry if isinstance(node, _expr.Function) else entry.body

def infer_shape(inputs, mod=None):
Expand Down

0 comments on commit a581dc8

Please sign in to comment.