Skip to content

Commit

Permalink
[Fix Bug]fix the bug of tensorflow frontend when parsing Range layer (#…
Browse files Browse the repository at this point in the history
…9999)

Co-authored-by: wangjiuyang <wang.jiuyang@intellif.com>
  • Loading branch information
ninesheep and wangjiuyang authored Jan 26, 2022
1 parent abdccf9 commit 92cd754
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/tvm/relay/frontend/tensorflow_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -2454,16 +2454,16 @@ def _impl(inputs, attr, params, mod):
delta = inputs[2]

# if all attributes are constant, evalute the range function and return relay.const
dtype = attr["Tidx"].name if "Tidx" in attr else str(start.dtype)
if all(
[
isinstance(start, (np.int32, np.int64, int, np.float32, np.float64, float)),
isinstance(limit, (np.int32, np.int64, int, np.float32, np.float64, float)),
isinstance(delta, (np.int32, np.int64, int, np.float32, np.float64, float)),
]
):
return tvm.relay.const(list(range(int(start), int(limit), int(delta))))
return tvm.relay.const(list(range(int(start), int(limit), int(delta))), dtype=dtype)

dtype = attr["Tidx"].name if "Tidx" in attr else str(start.dtype)
if isinstance(start, (np.int32, np.int64, int, np.float32, np.float64, float)):
start = _expr.const(start, dtype=dtype)
if isinstance(limit, (np.int32, np.int64, int, np.float32, np.float64, float)):
Expand Down

0 comments on commit 92cd754

Please sign in to comment.