[XPU][Graph] Replace boolean-mask assignment with torch.where (#60529)

Signed-off-by: zhenwei-intel <zhenwei.liu@intel.com>
Co-authored-by: Kunshang Ji <kunshang.ji@intel.com>
This commit is contained in:
liuzhenwei
2026-10-08 17:13:48 +08:00
committed by GitHub
co-authored by Kunshang Ji
parent 70bdce6133
commit 0004536dd0
+1 -1
View File
@@ -73,7 +73,7 @@ class MiMoMultiTokenPredictorLayer(nn.Module):
) -> torch.Tensor:
assert inputs_embeds is not None
# masking inputs at position 0, as not needed by MTP
inputs_embeds[positions == 0] = 0
inputs_embeds = torch.where(positions.unsqueeze(-1) == 0, 0, inputs_embeds)
inputs_embeds = self.token_layernorm(inputs_embeds)
previous_hidden_states = self.hidden_layernorm(previous_hidden_states)