| 294 | |
| 295 | template<typename scalar_t, typename index_t> |
| 296 | static OF_DEVICE_FUNC void SafeAdd2D(scalar_t* data, int h, int w, int sH, int sW, int H, int W, |
| 297 | scalar_t delta, const index_t NC_offset, |
| 298 | const index_t memory_span) { |
| 299 | if (WithinBounds2D(h, w, H, W)) { |
| 300 | #if defined(__CUDACC__) |
| 301 | cuda::atomic::Add(data + NC_offset + h * sH + w * sW, delta); |
| 302 | #else |
| 303 | data[NC_offset + h * sH + w * sW] += delta; |
| 304 | #endif |
| 305 | } |
| 306 | } |
| 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, |
no test coverage detected