diff --git a/backends/webgpu/test/op_tests/cases.py b/backends/webgpu/test/op_tests/cases.py index 1780f65ec11..d60e8a9568b 100644 --- a/backends/webgpu/test/op_tests/cases.py +++ b/backends/webgpu/test/op_tests/cases.py @@ -34,6 +34,7 @@ CatModule, CONFIGS as _CAT_CONFIGS, ) +from executorch.backends.webgpu.test.ops.test_minimum import MinimumModule from executorch.backends.webgpu.test.ops.test_mul import ( CONFIGS as _MUL_CONFIGS, MulModule, @@ -184,6 +185,18 @@ def _fn_config_suite(module_cls, configs) -> WebGPUTestSuite: ) +@register_op_test("minimum") +def _minimum_suite() -> WebGPUTestSuite: + # Same-shape numeric coverage (flat binary kernel; broadcast stays smoke). + return WebGPUTestSuite( + module_factory=lambda: MinimumModule(), + cases=[ + Case(name="2d", inputs=((M1, M2), (M1, M2))), + Case(name="3d", inputs=((S, S1, S2), (S, S1, S2))), + ], + ) + + @register_op_test("view_copy") def _view_copy_suite() -> WebGPUTestSuite: return _fn_config_suite(ViewModule, _VIEW_CONFIGS) diff --git a/backends/webgpu/test/ops/test_minimum.py b/backends/webgpu/test/ops/test_minimum.py new file mode 100644 index 00000000000..f8f8088fef5 --- /dev/null +++ b/backends/webgpu/test/ops/test_minimum.py @@ -0,0 +1,18 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +"""`aten.minimum.default` module for the WebGPU op-test framework. + +`MinimumModule` is imported by `cases.py`. minimum is a same-shape elementwise +binary op mirroring the landed `add`/`mul` pattern (flat 2D-dispatch kernel). +""" + +import torch + + +class MinimumModule(torch.nn.Module): + def forward(self, a: torch.Tensor, b: torch.Tensor) -> torch.Tensor: + return torch.minimum(a, b)