[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:
co-authored by
Kunshang Ji
parent
70bdce6133
commit
0004536dd0
@@ -73,7 +73,7 @@ class MiMoMultiTokenPredictorLayer(nn.Module):
|
|||||||
) -> torch.Tensor:
|
) -> torch.Tensor:
|
||||||
assert inputs_embeds is not None
|
assert inputs_embeds is not None
|
||||||
# masking inputs at position 0, as not needed by MTP
|
# 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)
|
inputs_embeds = self.token_layernorm(inputs_embeds)
|
||||||
previous_hidden_states = self.hidden_layernorm(previous_hidden_states)
|
previous_hidden_states = self.hidden_layernorm(previous_hidden_states)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user