Skip to content

Commit

Permalink
extend repeat_interleave op for relay.Expr (apache#8839)
Browse files Browse the repository at this point in the history
Co-authored-by: Valery Chernov <valery.chernov@deelvin.com>
  • Loading branch information
2 people authored and ylc committed Sep 29, 2021
1 parent 28d7c14 commit 8db94c4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/tvm/relay/frontend/pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,12 @@ def repeat_interleave(self, inputs, input_types):
if isinstance(inputs[1], int):
repeats = inputs[1]
axis = inputs[2]
elif isinstance(inputs[1], _expr.Expr):
if isinstance(inputs[1], _expr.Constant):
repeats = int(inputs[1].data.numpy())
else:
repeats, _ = try_infer_value(inputs[1], lambda ret: ret.tolist())
axis = inputs[2]
else:
msg = "Only repeat with one value as repeat is currently supported."
raise AssertionError(msg)
Expand Down

0 comments on commit 8db94c4

Please sign in to comment.