Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6d7d303
Implement the portable kernel for _embedding_bag.out
yenhao-huang Oct 6, 2026
4d616fe
Merge branch 'main' into fix/11323-portable-embedding-bag
yenhao-huang Oct 14, 2026
ac05960
fix: validate embedding bag inputs and preserve accumulation precision
yenhao-huang Oct 16, 2026
dd7afda
Merge pull request #39 from yenhao-huang/fix/embedding-bag-review-202…
yenhao-huang Oct 18, 2026
e930ad7
refactor: simplify embedding bag kernel structure
yenhao-huang Oct 18, 2026
9810885
Merge pull request #40 from yenhao-huang/fix/embedding-bag-review-202…
yenhao-huang Oct 18, 2026
da781bd
Merge branch 'main' into fix/11323-portable-embedding-bag
yenhao-huang Oct 26, 2026
5b0f8ff
Merge upstream main into embedding bag branch
yenhao-huang Oct 27, 2026
ad0c429
fix(kernels): match ATen offset2bag shape for embedding bag sum slow …
yenhao-huang Oct 30, 2026
635ccc2
fix(kernels): honor weight and output strides in embedding bag
yenhao-huang Oct 30, 2026
18d0721
fix(kernels): match ATen partial final offset handling in embedding bag
yenhao-huang Oct 30, 2026
68fa84e
Merge branch 'main' into fix/11323-portable-embedding-bag
yenhao-huang Oct 30, 2026
5240d82
Merge remote-tracking branch 'upstream/main' into fix/embedding-bag-r…
yenhao-huang Oct 30, 2026
c9d2c08
fix(kernels): keep static offset2bag for embedding bag sum
yenhao-huang Oct 30, 2026
7d1ddae
fix(exir): decompose _embedding_bag_forward_only to _embedding_bag
yenhao-huang Oct 30, 2026
15eecb9
Merge remote PR branch into fix/embedding-bag-review-20261016
yenhao-huang Oct 30, 2026
1665007
fix(kernels): accept Int or Long for each embedding bag index output
yenhao-huang Oct 31, 2026
a62495a
test(kernels): skip ExecuTorch-only embedding bag cases on ATen
yenhao-huang Oct 31, 2026
ef5c775
Merge upstream main and preserve embedding bag regression tests
yenhao-huang Nov 6, 2026
20caea0
Merge branch 'main' into fix/11323-portable-embedding-bag
JakeStevens Nov 6, 2026
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
31 changes: 31 additions & 0 deletions exir/program/test/test_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,37 @@ def forward(self, x):

to_edge(export(M(), (torch.randn(4),))).to_executorch()

def test_embedding_bag_frozen_weight(self):
model = torch.nn.EmbeddingBag(10, 3, mode="sum").requires_grad_(False)
inputs = (torch.tensor([1, 2, 4, 5, 4, 3]), torch.tensor([0, 2, 4]))
executorch_module = _load_for_executorch_from_buffer(
to_edge(export(model, inputs)).to_executorch().buffer
)
self.assertTrue(
torch.allclose(
executorch_module.run_method("forward", inputs)[0], model(*inputs)
)
)

def test_embedding_bag_int32_offsets(self):
# Export allocates the auxiliary outputs with the offsets dtype.
inputs = (
torch.tensor([1, 2, 4, 5, 4, 3]),
torch.tensor([0, 2, 4], dtype=torch.int32),
)
for mode in ("sum", "mean", "max"):
with self.subTest(mode=mode):
model = torch.nn.EmbeddingBag(10, 3, mode=mode)
executorch_module = _load_for_executorch_from_buffer(
to_edge(export(model, inputs)).to_executorch().buffer
)
self.assertTrue(
torch.allclose(
executorch_module.run_method("forward", inputs)[0],
model(*inputs),
)
)

def test_antialiased_resize(self):
class Resize(torch.nn.Module):
def forward(self, x):
Expand Down
5 changes: 5 additions & 0 deletions exir/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,11 @@ def _default_decomposition_table(
decomps[torch.ops.aten.empty_permuted.default] = _empty_permuted
# torch._check_tensor_all exports to this op, which has no decomposition in core.
decomps[torch.ops.aten._is_all_true.default] = torch.ops.aten.all.default
# embedding_bag with frozen weights exports to this op; it only skips
# saving tensors for the backward pass.
decomps[torch.ops.aten._embedding_bag_forward_only.default] = (
torch.ops.aten._embedding_bag.default
)
# pyre-fixme[7]: Expected `Dict[OpOverload, typing.Callable[..., executorch.exir....

never_decompose = []
Expand Down
2 changes: 2 additions & 0 deletions kernels/aten/functions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

- op: _conj_physical.out

- op: _embedding_bag.out

- op: _fake_quantize_per_tensor_affine_cachemask_tensor_qparams.out

- op: _fft_c2r.out
Expand Down
Loading
Loading