Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix Bug]fix the bug of tensorflow frontend when parsing Range layer #9999

Merged
merged 5 commits into from
Jan 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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