[Perf] Remove redundant clone for GLM, Deepseek etc (#46651)
Signed-off-by: yewentao256 <zhyanwentao@126.com>
This commit is contained in:
@@ -649,7 +649,7 @@ class AXK1DecoderLayer(nn.Module):
|
||||
) -> tuple[torch.Tensor, torch.Tensor]:
|
||||
# Self Attention
|
||||
if residual is None:
|
||||
residual = hidden_states.clone()
|
||||
residual = hidden_states
|
||||
hidden_states = self.input_layernorm(hidden_states)
|
||||
else:
|
||||
hidden_states, residual = self.input_layernorm(hidden_states, residual)
|
||||
|
||||
Reference in New Issue
Block a user