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)):