From f0e41abc437e1a19fd2d8bb41287ed8fffe8b6c3 Mon Sep 17 00:00:00 2001
From: Jerome Hue <jerome.hue@cea.fr>
Date: Thu, 27 Feb 2025 14:28:35 +0100
Subject: [PATCH] Add missing python binding for LeakyReset

The binding for the LeakyReset enumeration was missing, which was causing
an error when running python tests.
---
 python_binding/operator/pybind_MetaOperatorDefs.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/python_binding/operator/pybind_MetaOperatorDefs.cpp b/python_binding/operator/pybind_MetaOperatorDefs.cpp
index c55ec533a..9e266cfe2 100644
--- a/python_binding/operator/pybind_MetaOperatorDefs.cpp
+++ b/python_binding/operator/pybind_MetaOperatorDefs.cpp
@@ -400,6 +400,18 @@ void declare_LSTMOp(py::module &m) {
     )mydelimiter");
 }
 
+void declare_LeakyResetEnum(py::module &m) {
+    py::enum_<LeakyReset>(m, "leaky_reset", R"doc(
+        Enumeration for the Leaky neuron reset mode.
+
+        Subtraction: Membrane potential is subtracted by threshold upon spiking.
+        ToZero     : Membrane potential is forced to 0 upon spiking.
+    )doc")
+        .value("subtraction", LeakyReset::Subtraction)
+        .value("to_zero", LeakyReset::ToZero)
+        .export_values();
+}
+
 
 void declare_LeakyOp(py::module &m) {
     m.def("Leaky", &Leaky,
@@ -441,6 +453,7 @@ void init_MetaOperatorDefs(py::module &m) {
   declare_PaddedMaxPoolingOp<2>(m);
 //   declare_PaddedMaxPoolingOp<3>(m);
   declare_LSTMOp(m);
+  declare_LeakyResetEnum(m);
   declare_LeakyOp(m);
 
   py::class_<MetaOperator_Op, std::shared_ptr<MetaOperator_Op>, OperatorTensor>(m, "MetaOperatorOp", py::multiple_inheritance())
-- 
GitLab