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
4 changes: 2 additions & 2 deletions coreai_torch/_aten_to_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2227,11 +2227,11 @@ def replace_maxpool2d_with_indices(
x = _get_operand(values_map, node, 0)
args = node.args
kernel_size = args[1]
if isinstance(args[2], fx.Node):
if len(args) > 2 and isinstance(args[2], fx.Node):
raise ValueError(
f"Encountered dynamic stride at maxpool2d: node: {node}, name: {node.name}"
)
stride = args[2]
stride = args[2] if len(args) >= 3 else kernel_size
padding = args[3] if len(args) >= 4 else [0, 0]
dilation = args[4] if len(args) >= 5 else [1, 1]
ceil_mode = args[5] if len(args) >= 6 else False
Expand Down
2 changes: 2 additions & 0 deletions tests/ops/test_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -2686,6 +2686,8 @@ def forward(self, x: Tensor, y: Tensor) -> Tensor:
@pytest.mark.parametrize(
"input_shape, dtype, kernel_size, stride, padding, dilation, ceil_mode, dynamic_dims",
[
# Default parameters
((2, 4, 16, 16), torch.float32, 3, None, 0, 1, False, tuple()),
# Static — all pool configs, multiple shapes and dtypes
((2, 4, 16, 16), torch.float32, 3, 2, 1, 1, False, tuple()),
((2, 4, 16, 16), torch.float32, 3, 2, 0, 1, True, tuple()),
Expand Down