From c3ffeaeaba8ebcbcb1709e004e70879616cacd12 Mon Sep 17 00:00:00 2001 From: cmoineau <cyril.moineau@cea.fr> Date: Fri, 14 Feb 2025 15:28:15 +0000 Subject: [PATCH] Update def to def_static for static funtions. --- python_binding/operator/pybind_AvgPooling.cpp | 10 +++++----- python_binding/operator/pybind_ConstantOfShape.cpp | 8 ++++---- python_binding/operator/pybind_Squeeze.cpp | 4 ++-- python_binding/operator/pybind_Unsqueeze.cpp | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/python_binding/operator/pybind_AvgPooling.cpp b/python_binding/operator/pybind_AvgPooling.cpp index 24549e3f4..852b11303 100644 --- a/python_binding/operator/pybind_AvgPooling.cpp +++ b/python_binding/operator/pybind_AvgPooling.cpp @@ -31,17 +31,17 @@ template <DimIdx_t DIM> void declare_AvgPoolingOp(py::module &m) { const std::string pyClassName("AvgPooling" + std::to_string(DIM) + "DOp"); const std::string pyStaticAttrClassName("StaticAttributes" + pyClassName); - + py::class_<AvgPooling_Op<DIM>, std::shared_ptr<AvgPooling_Op<DIM>>, OperatorTensor>( m, pyClassName.c_str(), py::multiple_inheritance(), R"mydelimiter( Initialize an AvgPooling operator for a tensor. - This operator performs average pooling on the input tensor using the specified kernel dimensions + This operator performs average pooling on the input tensor using the specified kernel dimensions and stride dimensions. - :param kernel_dims: The size of the kernel (filter) applied during pooling. + :param kernel_dims: The size of the kernel (filter) applied during pooling. Specifies the dimensions of the kernel (e.g., [3, 3] for 2D pooling). :type kernel_dims: List[int] :param stride_dims: The stride of the pooling operation. Specifies how much the kernel moves in each step. @@ -52,8 +52,8 @@ template <DimIdx_t DIM> void declare_AvgPoolingOp(py::module &m) { const std::array<DimSize_t, DIM> &>(), py::arg("kernel_dims"), py::arg("stride_dims") = create_array<DimSize_t, DIM>(1)) - .def("get_inputs_name", &AvgPooling_Op<DIM>::getInputsName) - .def("get_outputs_name", &AvgPooling_Op<DIM>::getOutputsName) + .def_static("get_inputs_name", &AvgPooling_Op<DIM>::getInputsName) + .def_static("get_outputs_name", &AvgPooling_Op<DIM>::getOutputsName) .def_readonly_static("Type", &AvgPooling_Op<DIM>::Type); declare_registrable<AvgPooling_Op<DIM>>(m, pyClassName); diff --git a/python_binding/operator/pybind_ConstantOfShape.cpp b/python_binding/operator/pybind_ConstantOfShape.cpp index 07079d983..5a0e858f1 100644 --- a/python_binding/operator/pybind_ConstantOfShape.cpp +++ b/python_binding/operator/pybind_ConstantOfShape.cpp @@ -27,20 +27,20 @@ void init_ConstantOfShape(py::module &m) { R"mydelimiter( Initialize a ConstantOfShape operator. - :param value : Tensor with a given datatype that contains the value + :param value : Tensor with a given datatype that contains the value that will fill the output tensor. :type value : :py:class:`Tensor` )mydelimiter") .def("get_inputs_name", &ConstantOfShape_Op::getInputsName) - .def("get_outputs_name", &ConstantOfShape_Op::getOutputsName) - .def("value", &ConstantOfShape_Op::value); + .def_static("get_outputs_name", &ConstantOfShape_Op::getOutputsName) + .def_static("value", &ConstantOfShape_Op::value); m.def("ConstantOfShape", &ConstantOfShape, py::arg("value") = Tensor(0.f), py::arg("name") = "", R"mydelimiter( Initialize a node containing a ConstantOfShape operator. - :param value : Tensor with a given datatype that contains the value + :param value : Tensor with a given datatype that contains the value that will fill the output tensor. :type value : :py:class:`Tensor` :param name : Name of the node. diff --git a/python_binding/operator/pybind_Squeeze.cpp b/python_binding/operator/pybind_Squeeze.cpp index 188ce745d..f7ee4d722 100644 --- a/python_binding/operator/pybind_Squeeze.cpp +++ b/python_binding/operator/pybind_Squeeze.cpp @@ -32,8 +32,8 @@ void init_Squeeze(py::module &m) { & r in [-128 , 127] :type axes: :py:class: List[Int] )mydelimiter") - .def("get_inputs_name", &Squeeze_Op::getInputsName) - .def("get_outputs_name", &Squeeze_Op::getOutputsName) + .def_static("get_inputs_name", &Squeeze_Op::getInputsName) + .def_static("get_outputs_name", &Squeeze_Op::getOutputsName) .def("axes", &Squeeze_Op::axes); declare_registrable<Squeeze_Op>(m, "SqueezeOp"); diff --git a/python_binding/operator/pybind_Unsqueeze.cpp b/python_binding/operator/pybind_Unsqueeze.cpp index 7ef8af8b6..c21a7bcfa 100644 --- a/python_binding/operator/pybind_Unsqueeze.cpp +++ b/python_binding/operator/pybind_Unsqueeze.cpp @@ -28,8 +28,8 @@ void init_Unsqueeze(py::module &m) { :type axes: :py:class: List[Int] )mydelimiter") // Here we bind the methods of the Unsqueeze_Op that will want to access - .def("get_inputs_name", &Unsqueeze_Op::getInputsName) - .def("get_outputs_name", &Unsqueeze_Op::getOutputsName) + .def_static("get_inputs_name", &Unsqueeze_Op::getInputsName) + .def_static("get_outputs_name", &Unsqueeze_Op::getOutputsName) .def_readonly_static("Type", &Unsqueeze_Op::Type) ; -- GitLab