You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ms...@apache.org on 2025/11/30 10:13:38 UTC
(tvm) branch main updated: [Relax][PyTorch] Handle unknown output shapes for _sym_size_int (#18521)
This is an automated email from the ASF dual-hosted git repository.
mshr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 54c3fb42a7 [Relax][PyTorch] Handle unknown output shapes for _sym_size_int (#18521)
54c3fb42a7 is described below
commit 54c3fb42a71ca64c6aafb2af67de27349a2d9919
Author: Guan-Ming (Wesley) Chiu <10...@users.noreply.github.com>
AuthorDate: Sun Nov 30 18:13:31 2025 +0800
[Relax][PyTorch] Handle unknown output shapes for _sym_size_int (#18521)
---
python/tvm/relax/frontend/torch/base_fx_graph_translator.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/python/tvm/relax/frontend/torch/base_fx_graph_translator.py b/python/tvm/relax/frontend/torch/base_fx_graph_translator.py
index 33a22b34fc..e9a9cdd939 100644
--- a/python/tvm/relax/frontend/torch/base_fx_graph_translator.py
+++ b/python/tvm/relax/frontend/torch/base_fx_graph_translator.py
@@ -2553,6 +2553,11 @@ class BaseFXGraphImporter(metaclass=abc.ABCMeta):
shape = self.shape_of(x)
dim = node.args[1] if len(node.args) > 1 else node.kwargs.get("dim", 0)
+ # Handle case where shape is unknown (None) - this can happen for operations
+ # with dynamic output shapes.
+ if shape is None:
+ return self.block_builder.emit(relax.const(0, "int64"))
+
shape_dim = shape[dim]
if hasattr(shape_dim, "value"):
return self.block_builder.emit(relax.const(shape_dim.value, dtype="int32"))