Skip to content
Snippets Groups Projects
Commit b2d46b46 authored by Cyril Moineau's avatar Cyril Moineau
Browse files

Update def to def_static for static funtions.

parent b8fdfffd
No related branches found
No related tags found
1 merge request!333[Fix] Attribute snake case
...@@ -31,17 +31,17 @@ template <DimIdx_t DIM> void declare_AvgPoolingOp(py::module &m) { ...@@ -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 pyClassName("AvgPooling" + std::to_string(DIM) + "DOp");
const std::string pyStaticAttrClassName("StaticAttributes" + pyClassName); const std::string pyStaticAttrClassName("StaticAttributes" + pyClassName);
py::class_<AvgPooling_Op<DIM>, std::shared_ptr<AvgPooling_Op<DIM>>, OperatorTensor>( py::class_<AvgPooling_Op<DIM>, std::shared_ptr<AvgPooling_Op<DIM>>, OperatorTensor>(
m, pyClassName.c_str(), m, pyClassName.c_str(),
py::multiple_inheritance(), py::multiple_inheritance(),
R"mydelimiter( R"mydelimiter(
Initialize an AvgPooling operator for a tensor. 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. 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). Specifies the dimensions of the kernel (e.g., [3, 3] for 2D pooling).
:type kernel_dims: List[int] :type kernel_dims: List[int]
:param stride_dims: The stride of the pooling operation. Specifies how much the kernel moves in each step. :param stride_dims: The stride of the pooling operation. Specifies how much the kernel moves in each step.
...@@ -60,8 +60,8 @@ template <DimIdx_t DIM> void declare_AvgPoolingOp(py::module &m) { ...@@ -60,8 +60,8 @@ template <DimIdx_t DIM> void declare_AvgPoolingOp(py::module &m) {
py::arg("stride_dims") = create_array<DimSize_t, DIM>(1), py::arg("stride_dims") = create_array<DimSize_t, DIM>(1),
py::arg("dilations") = create_array<DimSize_t, DIM>(1), py::arg("dilations") = create_array<DimSize_t, DIM>(1),
py::arg("ceil_mode") = false) py::arg("ceil_mode") = false)
.def("get_inputs_name", &AvgPooling_Op<DIM>::getInputsName) .def_static("get_inputs_name", &AvgPooling_Op<DIM>::getInputsName)
.def("get_outputs_name", &AvgPooling_Op<DIM>::getOutputsName) .def_static("get_outputs_name", &AvgPooling_Op<DIM>::getOutputsName)
.def_readonly_static("Type", &AvgPooling_Op<DIM>::Type); .def_readonly_static("Type", &AvgPooling_Op<DIM>::Type);
declare_registrable<AvgPooling_Op<DIM>>(m, pyClassName); declare_registrable<AvgPooling_Op<DIM>>(m, pyClassName);
......
...@@ -27,20 +27,20 @@ void init_ConstantOfShape(py::module &m) { ...@@ -27,20 +27,20 @@ void init_ConstantOfShape(py::module &m) {
R"mydelimiter( R"mydelimiter(
Initialize a ConstantOfShape operator. 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. that will fill the output tensor.
:type value : :py:class:`Tensor` :type value : :py:class:`Tensor`
)mydelimiter") )mydelimiter")
.def("get_inputs_name", &ConstantOfShape_Op::getInputsName) .def("get_inputs_name", &ConstantOfShape_Op::getInputsName)
.def("get_outputs_name", &ConstantOfShape_Op::getOutputsName) .def_static("get_outputs_name", &ConstantOfShape_Op::getOutputsName)
.def("value", &ConstantOfShape_Op::value); .def_static("value", &ConstantOfShape_Op::value);
m.def("ConstantOfShape", &ConstantOfShape, py::arg("value") = Tensor(0.f), m.def("ConstantOfShape", &ConstantOfShape, py::arg("value") = Tensor(0.f),
py::arg("name") = "", py::arg("name") = "",
R"mydelimiter( R"mydelimiter(
Initialize a node containing a ConstantOfShape operator. 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. that will fill the output tensor.
:type value : :py:class:`Tensor` :type value : :py:class:`Tensor`
:param name : Name of the node. :param name : Name of the node.
......
...@@ -32,8 +32,8 @@ void init_Squeeze(py::module &m) { ...@@ -32,8 +32,8 @@ void init_Squeeze(py::module &m) {
& r in [-128 , 127] & r in [-128 , 127]
:type axes: :py:class: List[Int] :type axes: :py:class: List[Int]
)mydelimiter") )mydelimiter")
.def("get_inputs_name", &Squeeze_Op::getInputsName) .def_static("get_inputs_name", &Squeeze_Op::getInputsName)
.def("get_outputs_name", &Squeeze_Op::getOutputsName) .def_static("get_outputs_name", &Squeeze_Op::getOutputsName)
.def("axes", &Squeeze_Op::axes); .def("axes", &Squeeze_Op::axes);
declare_registrable<Squeeze_Op>(m, "SqueezeOp"); declare_registrable<Squeeze_Op>(m, "SqueezeOp");
......
...@@ -28,8 +28,8 @@ void init_Unsqueeze(py::module &m) { ...@@ -28,8 +28,8 @@ void init_Unsqueeze(py::module &m) {
:type axes: :py:class: List[Int] :type axes: :py:class: List[Int]
)mydelimiter") )mydelimiter")
// Here we bind the methods of the Unsqueeze_Op that will want to access // Here we bind the methods of the Unsqueeze_Op that will want to access
.def("get_inputs_name", &Unsqueeze_Op::getInputsName) .def_static("get_inputs_name", &Unsqueeze_Op::getInputsName)
.def("get_outputs_name", &Unsqueeze_Op::getOutputsName) .def_static("get_outputs_name", &Unsqueeze_Op::getOutputsName)
.def_readonly_static("Type", &Unsqueeze_Op::Type) .def_readonly_static("Type", &Unsqueeze_Op::Type)
; ;
......
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