[Perf] Remove redundant clone for GLM, Deepseek etc (#46651)
Signed-off-by: yewentao256 <zhyanwentao@126.com>
This commit is contained in:
@@ -1186,7 +1186,7 @@ class DeepseekV2DecoderLayer(nn.Module):
|
||||
) -> 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