mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
Update GratherGard to accumulate in fp32 (#4601)
This commit is contained in:
parent
9c75c29403
commit
aa328c2c20
1 changed files with 4 additions and 4 deletions
|
|
@ -40,15 +40,15 @@ __global__ void _GatherGradImpl(
|
|||
const int weight_row = itr * input_numel + ((int)input[idx]) * stride; //the offset of the input
|
||||
const int grad_row = (itr * numel + ((int)indices[idx])) * stride; //the offset of the gradient
|
||||
|
||||
T gradient[SZ];
|
||||
T weight[SZ];
|
||||
float gradient[SZ];
|
||||
float weight[SZ];
|
||||
|
||||
#pragma unroll
|
||||
for (int ii = 0; ii < SZ; ii++) {
|
||||
int feature_dim = start_feature + ii * GPU_WARP_SIZE;
|
||||
if (feature_dim < stride) {
|
||||
gradient[ii] = static_cast<T>(grad_output[grad_row + feature_dim]);
|
||||
weight[ii] = static_cast<T>(grad_weight[weight_row + feature_dim]);
|
||||
gradient[ii] = static_cast<float>(grad_output[grad_row + feature_dim]);
|
||||
weight[ii] = static_cast<float>(grad_weight[weight_row + feature_dim]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue