/
vuron
/
adept
Обзор
Документация
Войти
/
vuron
/
adept
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/backends/cpu/data_index.hpp
29 строк
666 B
kolkir
AvgPool2d implementation
08 фев 2025, 20:12
08 фев 2025, 20:12
61cfbe7
Код
Авторство
О чём код?
#pragma once #include <utility> namespace adept::cpu { template <typename T> inline T data_index_init(T offset) { return offset; } template <typename T, typename... Args> inline T data_index_init(T offset, T& x, const T& X, Args&&... args) { offset = data_index_init(offset, std::forward<Args>(args)...); x = offset % X; return offset / X; } inline bool data_index_step() { return true; } template <typename T, typename... Args> inline bool data_index_step(T& x, const T& X, Args&&... args) { if (data_index_step(std::forward<Args>(args)...)) { x = ((x + 1) == X) ? 0 : (x + 1); return x == 0; } return false; } } // namespace adept::cpu