Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions python/tvm/relay/frontend/tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1454,9 +1454,9 @@ def _impl(inputs, attr, params, mod):
break

if is_symbolic_shape:
ret = _op.shape_of(inputs[0], dtype="int32")
ret = _op.shape_of(inputs[0], dtype=attr["out_type"].name)
else:
ret = np.array(input_shape, dtype="int32")
ret = np.array(input_shape, dtype=attr["out_type"].name)
return ret

return _impl
Expand Down Expand Up @@ -1862,11 +1862,11 @@ def _impl(inputs, attr, params, mod):

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)
start = _expr.const(start, dtype=dtype)
if isinstance(limit, (np.int32, np.int64, int, np.float32, np.float64, float)):
limit = _expr.const(limit)
limit = _expr.const(limit, dtype=dtype)
if isinstance(delta, (np.int32, np.int64, int, np.float32, np.float64, float)):
delta = _expr.const(delta)
delta = _expr.const(delta, dtype=dtype)

return AttrCvt(
op_name="arange",
Expand Down
9 changes: 5 additions & 4 deletions tests/python/frontend/tensorflow/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -2768,10 +2768,11 @@ def test_forward_unpack():

def test_forward_range():
"""test operator Range"""
tf.reset_default_graph()
with tf.Graph().as_default():
tf.range(1, 18, 3, name="range")
compare_tf_with_tvm([], [], "range:0")
for dtype in [tf.int32, tf.int64]:
tf.reset_default_graph()
with tf.Graph().as_default():
tf.range(1, 18, 3, name="range", dtype=dtype)
compare_tf_with_tvm([], [], "range:0")

"""test type assignment for operator Range"""
tf.reset_default_graph()
Expand Down