You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ma...@apache.org on 2022/09/14 04:10:37 UTC
[tvm] 02/03: fix rebase
This is an automated email from the ASF dual-hosted git repository.
masahi pushed a commit to branch torchbench
in repository https://gitbox.apache.org/repos/asf/tvm.git
commit 5aa6d7c25360ee5b339c42f8c9f5c655943a4333
Author: YJ Shi <yu...@octoml.ai>
AuthorDate: Tue Sep 13 16:15:09 2022 -0700
fix rebase
---
python/tvm/relay/frontend/pytorch.py | 12 ++++--------
tests/python/frontend/pytorch/test_forward.py | 7 +++----
2 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/python/tvm/relay/frontend/pytorch.py b/python/tvm/relay/frontend/pytorch.py
index 9255c42383..e2badaabf7 100644
--- a/python/tvm/relay/frontend/pytorch.py
+++ b/python/tvm/relay/frontend/pytorch.py
@@ -39,11 +39,7 @@ from ..loops import while_loop
from ..prelude import Prelude, StaticTensorArrayOps
from ..ty import Any, TensorType, TupleType
from . import qnn_torch
-<<<<<<< HEAD
-from .common import AttrCvt, get_relay_op, gru_cell, logger, rnn_cell
-=======
-from .common import AttrCvt, fold_constant, get_relay_op, gru_cell, infer_shape, logger
->>>>>>> dfcf28b5d... add copy_ and embedding_bag
+from .common import AttrCvt, fold_constant, get_relay_op, gru_cell, logger
from .common import infer_shape as _infer_shape
from .common import infer_value as _infer_value
from .common import infer_value_simulated as _infer_value_simulated
@@ -3415,7 +3411,7 @@ class PyTorchOpConverter:
output = _op.random.multinomial(key, probs, num_samples)
_, indices = _expr.TupleWrapper(output, 2)
return indices
-
+
def embedding_bag(self, inputs, _):
assert len(inputs) == 9, "embedding_bag needs 9 arguments"
(
@@ -3433,10 +3429,10 @@ class PyTorchOpConverter:
assert scale_grad_by_freq == 0, "scale_grad_by_freq not supported in embedding_bag."
assert padding_idx == None, "padding_idx not supported in embedding_bag."
- assert len(infer_shape(indices)) == 1, "Expects 1D indices for aten::embedding_bag."
+ assert len(_infer_shape(indices)) == 1, "Expects 1D indices for aten::embedding_bag."
offsets_const_fold = fold_constant(offsets_1d)
-
+ print(offsets_const_fold)
assert isinstance(
offsets_const_fold, _expr.Constant
), "Only constant offsets are supported."
diff --git a/tests/python/frontend/pytorch/test_forward.py b/tests/python/frontend/pytorch/test_forward.py
index f9ff4a212c..58a4dfbe94 100755
--- a/tests/python/frontend/pytorch/test_forward.py
+++ b/tests/python/frontend/pytorch/test_forward.py
@@ -4608,7 +4608,6 @@ def test_mod():
verify_model(test_fn, [torch.tensor([1, 2, 3, 4, 5]), torch.tensor(-1.5)])
-<<<<<<< HEAD
def test_softmax_fuse():
# https://github.com/apache/tvm/issues/12001
class Model(torch.nn.Module):
@@ -4686,15 +4685,15 @@ def test_multinomial():
_test_multinomial(1),
[torch.rand(size=[4, 5]).float()],
cpu_only=True,
- check_correctness=False,
-=======
+ )
+
+
def test_embedding_bag():
embedding_matrix = torch.rand(10, 3)
inp = torch.tensor([[1, 2, 4, 5], [4, 3, 2, 9], [6, 7, 8, 9]])
verify_model(
F.embedding_bag,
[inp, embedding_matrix],
->>>>>>> dfcf28b5d... add copy_ and embedding_bag
)