diff --git a/aidge_core/unit_tests/test_parameters.py b/aidge_core/unit_tests/test_parameters.py index 02c7598820d2429bc49ff9a2f02c8ee841783173..170d726db0a49cd81f520a6ce8d85a5c761e7b3f 100644 --- a/aidge_core/unit_tests/test_parameters.py +++ b/aidge_core/unit_tests/test_parameters.py @@ -27,21 +27,21 @@ class test_parameters(unittest.TestCase): out_channels = 8 k_dims = [2, 2] conv_op = aidge_core.Conv2D(in_channels , out_channels, k_dims).get_operator() - self.assertEqual(conv_op.get("InChannels"), in_channels) - self.assertEqual(conv_op.get("OutChannels"), out_channels) - self.assertEqual(conv_op.get("KernelDims"), k_dims) + self.assertEqual(conv_op.get_parameter("InChannels"), in_channels) + self.assertEqual(conv_op.get_parameter("OutChannels"), out_channels) + self.assertEqual(conv_op.get_parameter("KernelDims"), k_dims) def test_fc(self): out_channels = 8 nb_bias = True fc_op = aidge_core.FC(out_channels, nb_bias).get_operator() - self.assertEqual(fc_op.get("OutChannels"), out_channels) - self.assertEqual(fc_op.get("NoBias"), nb_bias) + self.assertEqual(fc_op.get_parameter("OutChannels"), out_channels) + self.assertEqual(fc_op.get_parameter("NoBias"), nb_bias) def test_matmul(self): out_channels = 8 matmul_op = aidge_core.Matmul(out_channels).get_operator() - self.assertEqual(matmul_op.get("OutChannels"), out_channels) + self.assertEqual(matmul_op.get_parameter("OutChannels"), out_channels) def test_producer_1D(self): dims = [5] @@ -71,7 +71,7 @@ class test_parameters(unittest.TestCase): def test_leaky_relu(self): negative_slope = 0.25 leakyrelu_op = aidge_core.LeakyReLU(negative_slope).get_operator() - self.assertEqual(leakyrelu_op.get("NegativeSlope"), negative_slope) + self.assertEqual(leakyrelu_op.get_parameter("NegativeSlope"), negative_slope) if __name__ == '__main__': unittest.main() diff --git a/python_binding/operator/pybind_GenericOperator.cpp b/python_binding/operator/pybind_GenericOperator.cpp index 3e2c195e850b9c9b6f46c7b57fb7a2812e93f7a5..9cb33f6ae9e4f598c0650a3c7a7d713bb08d8137 100644 --- a/python_binding/operator/pybind_GenericOperator.cpp +++ b/python_binding/operator/pybind_GenericOperator.cpp @@ -20,7 +20,7 @@ namespace py = pybind11; namespace Aidge { void init_GenericOperator(py::module& m) { - py::class_<GenericOperator_Op, std::shared_ptr<GenericOperator_Op>, Operator>(m, "GenericOperatorOp", + py::class_<GenericOperator_Op, std::shared_ptr<GenericOperator_Op>, Operator, DynamicParameters>(m, "GenericOperatorOp", py::multiple_inheritance()); m.def("GenericOperator", &GenericOperator, py::arg("type"), py::arg("nbDataIn"), py::arg("nbIn"), py::arg("nbOut"), py::arg("name") = ""); diff --git a/python_binding/utils/pybind_Parameter.cpp b/python_binding/utils/pybind_Parameter.cpp index f9344796e6062db7789bb2431c5c05e0aed1ad35..909b3063b74e274b7937cda7d698d1625f6f59b2 100644 --- a/python_binding/utils/pybind_Parameter.cpp +++ b/python_binding/utils/pybind_Parameter.cpp @@ -11,7 +11,7 @@ void init_Parameters(py::module& m){ .def("get_parameters_name", &Parameters::getParametersName) .def("get_parameter", &Parameters::getPy, py::arg("name")); - py::class_<DynamicParameters, std::shared_ptr<DynamicParameters>>(m, "DynamicParameters") + py::class_<DynamicParameters, std::shared_ptr<DynamicParameters>, Parameters>(m, "DynamicParameters") .def("add_parameter", &DynamicParameters::addParameter<bool>) .def("add_parameter", &DynamicParameters::addParameter<int>) .def("add_parameter", &DynamicParameters::addParameter<float>)