Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CodeStyle][Typos][C-2] Fix typo (Caculate) #70490

Merged
merged 2 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading