Skip to content

Commit

Permalink
[CodeStyle][Typos][C-2] Fix typo (Caculate) (PaddlePaddle#70490)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinyouzhi authored Dec 27, 2024
1 parent 4433914 commit 063b11a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ static inline int64_t NumBlocks(const int64_t N) {
}

template <typename T, typename IndexT>
__global__ void CaculateSoftLogitsGrad(T* logits_grad,
const IndexT* labels,
const T* smooth_weight,
const IndexT ignore_index,
const int64_t start_index,
const int64_t end_index,
const int64_t N,
const int64_t D,
const int64_t C) {
__global__ void CalculateSoftLogitsGrad(T* logits_grad,
const IndexT* labels,
const T* smooth_weight,
const IndexT ignore_index,
const int64_t start_index,
const int64_t end_index,
const int64_t N,
const int64_t D,
const int64_t C) {
CUDA_KERNEL_LOOP_TYPE(i, N, int64_t) {
for (int j = 0; j < C; ++j) {
auto real_label = labels[i * C + j];
Expand Down Expand Up @@ -111,7 +111,7 @@ void CSoftmaxWithMultiLabelCrossEntropyGradKernel(
const int64_t end_index = start_index + D;

if (label_type == phi::DataType::INT32) {
CaculateSoftLogitsGrad<T, int32_t>
CalculateSoftLogitsGrad<T, int32_t>
<<<blocks_cal, threads, 0, dev_ctx.stream()>>>(logit_grad_2d.data<T>(),
labels->data<int32_t>(),
smooth_weight->data<T>(),
Expand All @@ -130,7 +130,7 @@ void CSoftmaxWithMultiLabelCrossEntropyGradKernel(
C,
sum_multi_label_loss);
} else if (label_type == phi::DataType::INT64) {
CaculateSoftLogitsGrad<T, int64_t>
CalculateSoftLogitsGrad<T, int64_t>
<<<blocks_cal, threads, 0, dev_ctx.stream()>>>(logit_grad_2d.data<T>(),
labels->data<int64_t>(),
smooth_weight->data<T>(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ __global__ void SoftMaskLabelByIndex(T* predicted_logits,
}

template <typename T, typename IndexT>
__global__ void CaculateSoftLoss(T* loss,
const T* predict_logits,
const T* sum_exp_logits,
const IndexT* label,
const T* smooth_weight,
const int64_t ignore_index,
const int64_t N,
const int64_t C,
const bool sum_multi_label_loss) {
__global__ void CalculateSoftLoss(T* loss,
const T* predict_logits,
const T* sum_exp_logits,
const IndexT* label,
const T* smooth_weight,
const int64_t ignore_index,
const int64_t N,
const int64_t C,
const bool sum_multi_label_loss) {
CUDA_KERNEL_LOOP_TYPE(i, N, int64_t) {
T tmp_loss = static_cast<T>(0);
loss[i] = static_cast<T>(0);
Expand Down Expand Up @@ -272,7 +272,7 @@ struct CSoftmaxWithMultiLabelCrossEntropyFunctor<phi::GPUContext, T> {
comm_ctx->AllReduce(&sum_exp_logits, sum_exp_logits, ncclSum, stream);

if (label_type == phi::DataType::INT32) {
CaculateSoftLoss<T, int32_t>
CalculateSoftLoss<T, int32_t>
<<<blocks, threads, 0, dev_ctx.stream()>>>(loss_2d.data<T>(),
predicted_logits.data<T>(),
sum_exp_logits.data<T>(),
Expand All @@ -284,7 +284,7 @@ struct CSoftmaxWithMultiLabelCrossEntropyFunctor<phi::GPUContext, T> {
sum_multi_label_loss);

} else {
CaculateSoftLoss<T, int64_t>
CalculateSoftLoss<T, int64_t>
<<<blocks, threads, 0, dev_ctx.stream()>>>(loss_2d.data<T>(),
predicted_logits.data<T>(),
sum_exp_logits.data<T>(),
Expand Down

0 comments on commit 063b11a

Please sign in to comment.