Skip to content
Snippets Groups Projects
Commit 670fb293 authored by Olivier BICHLER's avatar Olivier BICHLER
Browse files

Use macro helper for registrar

parent dcbeb57f
No related branches found
No related tags found
2 merge requests!93Release v0.3.0,!79Refactor OperatorImpl for backend/export
Pipeline #53596 failed
......@@ -23,19 +23,17 @@
#include "aidge/utils/Types.h"
namespace Aidge {
// Operator implementation entry point for the backend
using ReLUImpl_cpu = OperatorImpl_cpu<ReLU_Op,
void(const std::size_t, const void*, void*),
void(const std::size_t, const void*, const void*, void*)>;
// class ReLUImpl_cpu : public OperatorImpl_cpu<ReLU_Op,
// void(const std::size_t, const void*, void*),
// void(const std::size_t, const void*, const void*, void*)>
// {
// public:
// void forward() override;
// void backward() override;
// };
// Implementation entry point registration to Operator
REGISTRAR(ReLU_Op, "cpu", Aidge::ReLUImpl_cpu::create);
////////////////////////////////////////////////////////////////////////////////
// Kernels
template <class I, class O>
void ReLUImpl_cpu_forward_kernel(std::size_t inputLenght,
const void* input_,
......@@ -62,19 +60,16 @@ void ReLUImpl_cpu_backward_kernel(const std::size_t inputLenght,
}
}
namespace {
static Registrar<ReLU_Op> registrarReLUImpl_cpu("cpu", Aidge::ReLUImpl_cpu::create);
static Registrar<ReLUImpl_cpu> registrarReLUImpl_cpu_float(
// Kernels registration to implementation entry point
REGISTRAR(ReLUImpl_cpu,
{DataType::Float32},
{ProdConso::inPlaceModel, Aidge::ReLUImpl_cpu_forward_kernel<float, float>, Aidge::ReLUImpl_cpu_backward_kernel<float, float, float>});
static Registrar<ReLUImpl_cpu> registrarReLUImpl_cpu_double(
REGISTRAR(ReLUImpl_cpu,
{DataType::Float64},
{ProdConso::inPlaceModel, Aidge::ReLUImpl_cpu_forward_kernel<double, double>, Aidge::ReLUImpl_cpu_backward_kernel<double, double, double>});
static Registrar<ReLUImpl_cpu> registrarReLUImpl_cpu_int(
REGISTRAR(ReLUImpl_cpu,
{DataType::Int32},
{ProdConso::inPlaceModel, Aidge::ReLUImpl_cpu_forward_kernel<int, int>, Aidge::ReLUImpl_cpu_backward_kernel<int, int, int>});
}
} // namespace Aidge
#endif /* AIDGE_CPU_OPERATOR_RELUIMPL_H_ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment