diff --git a/include/aidge/graph/GraphView.hpp b/include/aidge/graph/GraphView.hpp index 481099726843146173a37fcddc3bf69723b1a70e..4dea1ed974650ba9ae10c60c720733aa1581b055 100644 --- a/include/aidge/graph/GraphView.hpp +++ b/include/aidge/graph/GraphView.hpp @@ -428,4 +428,4 @@ private: }; } // namespace Aidge -#endif /* AIDGE_CORE_GRAPH_GRAPHVIEW_H_ */ \ No newline at end of file +#endif /* AIDGE_CORE_GRAPH_GRAPHVIEW_H_ */ diff --git a/include/aidge/graph/Node.hpp b/include/aidge/graph/Node.hpp index f1d0a39d4bd7dba6990a46d61f7456c03244e44e..de9f178347a228796d56d1653adddfed76ea7c5b 100644 --- a/include/aidge/graph/Node.hpp +++ b/include/aidge/graph/Node.hpp @@ -187,7 +187,7 @@ public: IOIndex_t getNbFreeDataInputs() const; /** - * @brief List input ids of children liked to outputs of the node + * @brief List input ids of children linked to outputs of the node * @return std::vector<std::vector<std::pair<std::shared_ptr<Node>, * IOIndex_t>>> */ diff --git a/include/aidge/hook/ExecTime.hpp b/include/aidge/hook/ExecTime.hpp index 212fef58696be702e89c8ad973dcc0dd0fc389ae..0964d9575b7ad345d5e07c9f19c7e56a3b69c813 100644 --- a/include/aidge/hook/ExecTime.hpp +++ b/include/aidge/hook/ExecTime.hpp @@ -18,7 +18,7 @@ #define execTime_H_ #include "aidge/operator/Operator.hpp" -#include "aidge/hook/hook.hpp" +#include "aidge/hook/Hook.hpp" #include <memory> #include <chrono> #include <vector> diff --git a/include/aidge/hook/OutputRange.hpp b/include/aidge/hook/OutputRange.hpp index a2da2a997d594c0ef78fb7c31f33b32c3495c4eb..355f4aaa15a6bcd77d99ec2dad344a45f8f9edc0 100644 --- a/include/aidge/hook/OutputRange.hpp +++ b/include/aidge/hook/OutputRange.hpp @@ -18,7 +18,7 @@ #define AIDGE_CORE_HOOK_OUTPUTRANGE_H_ #include "aidge/operator/Operator.hpp" -#include "aidge/hook/hook.hpp" +#include "aidge/hook/Hook.hpp" #include <memory> #include <chrono> #include <vector> diff --git a/include/aidge/operator/Scaling.hpp b/include/aidge/operator/Scaling.hpp index 353666fb3950d034a7dbe8ec1d3ebdb312679f95..43dd7beb10b49c3695e6c55fac0449a34565dd7f 100644 --- a/include/aidge/operator/Scaling.hpp +++ b/include/aidge/operator/Scaling.hpp @@ -28,12 +28,12 @@ namespace Aidge { enum class ScalingAttr { - scalingFactor + scalingFactor, quantizedNbBits, isOutputUnsigned }; class Scaling_Op : public Operator, public Registrable<Scaling_Op, std::string, std::unique_ptr<OperatorImpl>(const Scaling_Op&)>, - public StaticAttributes<ScalingAttr, float> { + public StaticAttributes<ScalingAttr, float, size_t, bool> { public: // FIXME: change accessibility std::shared_ptr<Tensor> mInput = std::make_shared<Tensor>(); @@ -44,16 +44,18 @@ public: Scaling_Op() = delete; - using Attributes_ = StaticAttributes<ScalingAttr, float>; + using Attributes_ = StaticAttributes<ScalingAttr, float, std::size_t, bool>; template <ScalingAttr e> using attr = typename Attributes_::template attr<e>; - Scaling_Op(float scalingFactor) + Scaling_Op(float scalingFactor, std::size_t nbBits, bool isOutputUnsigned) : Operator(Type), Attributes_( - attr<ScalingAttr::scalingFactor>(scalingFactor)) - { - setDatatype(DataType::Float32); - } + attr<ScalingAttr::scalingFactor>(scalingFactor), + attr<ScalingAttr::quantizedNbBits>(nbBits), + attr<ScalingAttr::isOutputUnsigned>(isOutputUnsigned)) { + + setDatatype(DataType::Float32); + } /** * @brief Copy-constructor. Copy the operator attributes and its output tensor(s), but not its input tensors (the new operator has no input associated). @@ -154,15 +156,21 @@ public: } }; +/* inline std::shared_ptr<Node> Scaling(float scalingFactor = 1.0f, const std::string& name = "") { return std::make_shared<Node>(std::make_shared<Scaling_Op>(scalingFactor), name); } +*/ +inline std::shared_ptr<Node> Scaling(float scalingFactor = 1.0f, std::size_t quantizedNbBits=8, bool isOutputUnsigned=true, const std::string& name = "") { + return std::make_shared<Node>(std::make_shared<Scaling_Op>(scalingFactor,quantizedNbBits, isOutputUnsigned), name); +} + } namespace { template <> const char* const EnumStrings<Aidge::ScalingAttr>::data[] - = {"scalingFactor"}; + = {"scalingFactor", "quantizedNbBits", "isOutputUnsigned"}; } #endif /* __AIDGE_CORE_OPERATOR_RELU_H__ */ diff --git a/include/aidge/scheduler/Scheduler.hpp b/include/aidge/scheduler/Scheduler.hpp index 1896894ee8690cedaef696394da0829604e36211..faf6c49bdbe28e7214f06a4d116cf23a1739154f 100644 --- a/include/aidge/scheduler/Scheduler.hpp +++ b/include/aidge/scheduler/Scheduler.hpp @@ -64,6 +64,9 @@ public: std::vector<std::shared_ptr<Node>> getStaticScheduling(){ return mStaticSchedule; } + std::shared_ptr<GraphView> getGraphView(){ + return mGraphView; + } private: /** diff --git a/python_binding/operator/pybind_Operator.cpp b/python_binding/operator/pybind_Operator.cpp index 6154c5b569d04d61514c5663590d04bfafcd931e..b786a27dd04d218da94c148a8087a4b89f8ed6aa 100644 --- a/python_binding/operator/pybind_Operator.cpp +++ b/python_binding/operator/pybind_Operator.cpp @@ -20,6 +20,7 @@ void init_Operator(py::module& m){ py::class_<Operator, std::shared_ptr<Operator>>(m, "Operator") .def("output", &Operator::output, py::arg("outputIdx")) .def("input", &Operator::input, py::arg("inputIdx")) + .def("nb_inputs", &Operator::nbInputs) .def("nb_data_inputs", &Operator::nbDataInputs) .def("nb_outputs", &Operator::nbOutputs) .def("output_dims_forwarded", &Operator::outputDimsForwarded) @@ -29,6 +30,8 @@ void init_Operator(py::module& m){ .def("forward", &Operator::forward) // py::keep_alive forbide Python to garbage collect implementation will the Operator is not garbade collected ! .def("set_impl", &Operator::setImpl, py::arg("implementation"), py::keep_alive<1, 2>()) + .def("get_hook", &Operator::getHook) + .def("add_hook", &Operator::addHook) ; } }