Skip to content
Snippets Groups Projects
Commit 75d25d42 authored by Lucas Lopez's avatar Lucas Lopez
Browse files

cast operator pybind

parent 5991c8d6
No related branches found
No related tags found
2 merge requests!279v0.4.0,!251Cast operator pybind
Pipeline #59301 passed
/********************************************************************************
* Copyright (c) 2023 CEA-List
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
********************************************************************************/
#include <pybind11/pybind11.h>
#include <string>
#include "aidge/backend/OperatorImpl.hpp"
#include "aidge/data/Tensor.hpp"
#include "aidge/operator/Cast.hpp"
#include "aidge/operator/OperatorTensor.hpp"
#include "aidge/utils/Types.h"
namespace py = pybind11;
namespace Aidge {
void init_Cast(py::module &m) {
// Binding for CastOp class
auto pyCastOp = py::class_<Cast_Op, std::shared_ptr<Cast_Op>, OperatorTensor>(m, "CastOp", py::multiple_inheritance(),R"mydelimiter(
CastOp is a tensor operator that casts the input tensor to a data type specified by the target_type argument.
:param target_type: data type of the output tensor
:type target_type: Datatype
:param name: name of the node.
)mydelimiter")
.def(py::init<DataType>(), py::arg("target_type"))
.def("target_type", &Cast_Op::targetType, "Get the targeted type, output tensor data type")
.def_static("get_inputs_name", &Cast_Op::getInputsName, "Get the names of the input tensors.")
.def_static("get_outputs_name", &Cast_Op::getOutputsName, "Get the names of the output tensors.");
// Binding for the Cast function
m.def("Cast", &Cast, py::arg("target_type"), py::arg("name") = "",
R"mydelimiter(
CastOp is a tensor operator that casts the input tensor to a data type specified by the target_type argument.
:param target_type: data type of the output tensor
:type target_type: Datatype
:param name: name of the node.
)mydelimiter");
}
} // namespace Aidge
\ No newline at end of file
......@@ -36,6 +36,7 @@ void init_Atan(py::module&);
void init_AvgPooling(py::module&);
void init_BatchNorm(py::module&);
void init_BitShift(py::module&);
void init_Cast(py::module&);
void init_Clip(py::module&);
void init_Concat(py::module&);
void init_ConstantOfShape(py::module&);
......@@ -127,6 +128,7 @@ void init_Aidge(py::module& m) {
init_AvgPooling(m);
init_BatchNorm(m);
init_BitShift(m);
init_Cast(m);
init_Clip(m);
init_Concat(m);
init_Conv(m);
......
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