MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / ForEachFast

Function ForEachFast

oneflow/user/kernels/normalization_kernel.cpp:228–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226// NOTE(Liang Depeng): helper functions to process datas for specific channel over all samples.
227template<typename T, typename DataProcessor>
228static inline void ForEachFast(const T* data, const int64_t batch_size, const int64_t spatial_size,
229 const int64_t jump_step, const int64_t channel_idx,
230 DataProcessor data_processor) {
231 const int64_t start_offset = channel_idx * spatial_size;
232 const T* tmp_data = data + start_offset;
233 for (int64_t outer = 0; outer < batch_size; ++outer) {
234 for (int64_t i = 0; i < spatial_size; ++i) { data_processor(&tmp_data[i]); }
235 tmp_data += jump_step;
236 }
237}
238
239template<typename T, typename DataProcessor>
240static inline void ForEachFast(const T* in_data1, const T* in_data2, const int64_t batch_size,

Callers 1

ComputeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected