Skip to content
Snippets Groups Projects

Improved scheduling

Merged Olivier BICHLER requested to merge scheduling into dev
1 file
+ 4
4
Compare changes
  • Side-by-side
  • Inline
@@ -49,12 +49,12 @@ void GlobalAveragePoolingImpl_cpu_forward_kernel(
for (DimSize_t channel = 0; channel < dims[1]; ++channel) {
const I *filter_start = std::next(
input, (batch * in_batch_nb_elems) + (channel * in_channel_nb_elems));
I sum = 0;
I mean = 0;
for (size_t i = 0; i < in_channel_nb_elems; ++i) {
sum += filter_start[i];
// Single pass numerically stable mean, using the fmaf
mean = fmaf(filter_start[i] - mean, 1.0f/(i+1), mean);
}
output[batch * out_batch_nb_elems + channel] =
sum / static_cast<I>(in_channel_nb_elems);
output[batch * out_batch_nb_elems + channel] = mean;
}
}
}
Loading