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

Function SafeAdd3D

oneflow/user/kernels/grid_sample_kernel_util.h:309–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307
308template<typename scalar_t, typename index_t>
309static OF_DEVICE_FUNC void SafeAdd3D(scalar_t* data, int d, int h, int w, int sD, int sH, int sW,
310 int D, int H, int W, scalar_t delta, const index_t NC_offset,
311 const index_t memory_span) {
312 if (WithinBounds3D(d, h, w, D, H, W)) {
313#if defined(__CUDACC__)
314 cuda::atomic::Add(data + NC_offset + d * sD + h * sH + w * sW, delta);
315#else
316 data[NC_offset + d * sD + h * sH + w * sW] += delta;
317#endif
318 }
319}
320
321template<typename scalar_t, typename index_t>
322static OF_DEVICE_FUNC void AddValueBounded(scalar_t* data, scalar_t x, scalar_t y, int W, int H,

Callers 1

XPU_1D_KERNEL_LOOPFunction · 0.85

Calls 2

WithinBounds3DFunction · 0.85
AddClass · 0.85

Tested by

no test coverage detected