Skip to content

Commit

Permalink
refine rescale_grad (#36490)
Browse files Browse the repository at this point in the history
  • Loading branch information
sneaxiy authored Oct 17, 2021
1 parent 314cc49 commit 4e036fa
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions paddle/fluid/operators/optimizers/lars_momentum_op.cu
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ __global__ void L2NormKernel(
__shared__ MT s_buffer[2];
int tid = threadIdx.x + blockDim.x * blockIdx.x;
int grid_stride = LARS_BLOCK_SIZE * gridDim.x;
const MT rescale_pow = rescale_grad * rescale_grad;

MT p_tmp = static_cast<MT>(0);
MT g_tmp = static_cast<MT>(0);
Expand Down Expand Up @@ -190,7 +189,7 @@ __global__ void L2NormKernel(
}
__syncthreads();
*p_n = Sqrt(s_buffer[0]);
*g_n = Sqrt(rescale_pow * s_buffer[1]);
*g_n = rescale_grad * Sqrt(s_buffer[1]);
#endif
}

Expand Down

0 comments on commit 4e036fa

Please sign in to comment.