From e0ad1bb5026f5d40e55c4a80c7dd85d4688b1215 Mon Sep 17 00:00:00 2001 From: wangjiuyang Date: Thu, 20 Jan 2022 17:03:19 +0800 Subject: [PATCH] [Fix Bug]fix the bug of tensorflow frontend when parsing Range layer --- python/tvm/relay/frontend/tensorflow_ops.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/tvm/relay/frontend/tensorflow_ops.py b/python/tvm/relay/frontend/tensorflow_ops.py index df8b7438af88..9b36d712e9ec 100644 --- a/python/tvm/relay/frontend/tensorflow_ops.py +++ b/python/tvm/relay/frontend/tensorflow_ops.py @@ -2454,6 +2454,7 @@ 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)), @@ -2461,9 +2462,8 @@ def _impl(inputs, attr, params, mod): 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)):