| 307 | |
| 308 | template<typename scalar_t, typename index_t> |
| 309 | static 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 | |
| 321 | template<typename scalar_t, typename index_t> |
| 322 | static OF_DEVICE_FUNC void AddValueBounded(scalar_t* data, scalar_t x, scalar_t y, int W, int H, |
no test coverage detected