Skip to content

Commit 80df2ee

Browse files
authored
Phonon: overlap-add the depthwise upsample with padding (#25151)
Summary: `DepthwiseConvTranspose1dAsMul`, the swap for the Mimi upsample's depthwise transposed convolution, added the two halves of each step's kernel by concatenating each with a zeros tensor. `new_zeros` lowers to `aten.full`, which XNNPACK left on the CPU. Padding each half with `F.pad` computes the same sum with `constant_pad_nd`, which XNNPACK, Vulkan and MLX lower. XNNPACK no longer leaves `aten.full` undelegated in `mimi_decode`, and Vulkan still lowers `mimi_decode` as one partition. Authored with Claude Code. Differential Revision: D132441808 Pull Request resolved: #25151
1 parent f8907c1 commit 80df2ee

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎examples/models/phonon/source_transformations.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ def forward(self, x: torch.Tensor) -> torch.Tensor:
177177
y = x.unsqueeze(3) * self.weight # [b, c, n, 2s]
178178
head = y[..., :s].reshape(b, c, n * s)
179179
tail = y[..., s:].reshape(b, c, n * s)
180-
zeros = x.new_zeros(b, c, s)
181-
return torch.cat([head, zeros], 2) + torch.cat([zeros, tail], 2)
180+
return F.pad(head, (0, s)) + F.pad(tail, (s, 0))
182181

183182

184183
def _swap(root: nn.Module, cls: type, make) -> int:

0 commit comments

Comments
 (0)