Skip to content
Open
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
13 changes: 13 additions & 0 deletions backends/webgpu/test/op_tests/cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
18 changes: 18 additions & 0 deletions backends/webgpu/test/ops/test_minimum.py
Original file line number Diff line number Diff line change
@@ -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)
Loading