Operators ========= .. contents:: :depth: 2 :local: Operator base class ------------------- :class:`aidge_core.Operator` is Aidge's base class for describing a mathematical operator. It does not make any assumption on the data coding. .. tab-set:: :sync-group: language .. tab-item:: Python :sync: python .. autoclass:: aidge_core.Operator :members: :inherited-members: .. tab-item:: C++ :sync: cpp .. doxygenclass:: Aidge::Operator OperatorTensor base class ------------------------- :class:`aidge_core.OperatorTensor` derives from the :class:`aidge_core.Operator` base class and is the base class for any tensor-based operator. .. tab-set:: :sync-group: language .. tab-item:: Python :sync: python .. autoclass:: aidge_core.OperatorTensor :members: :inherited-members: .. tab-item:: C++ :sync: cpp .. doxygenclass:: Aidge::OperatorTensor Generic Operator ---------------- A generic tensor-based operator can be used to model any kind of mathematical operator that takes a defined number of inputs, produces a defined number of outputs and can have some attributes. It is possible to provide a function that produces the output tensors size w.r.t. the inputs size. It has a default consumer-producer model (require and consume all inputs full tensors and produces output full tensors). This is the default operator used for unsupported ONNX operators when loading an ONNX model. While it obviously cannot be executed, a generic operator has still some usefulness: - It allows loading any graph even with unknown operators. It is possible to identify exactly all the missing operator types and their position in the graph; - It can be searched and manipulated with graph matching, allowing for example to replace it with alternative operators; - It can be scheduled and included in the graph static scheduling; - 🚧 A custom implementation may be provided in the future, even in pure Python, for rapid integration and prototyping. .. tab-set:: :sync-group: language .. tab-item:: Python :sync: python .. autofunction:: aidge_core.GenericOperator .. tab-item:: C++ :sync: cpp .. doxygenfunction:: Aidge::GenericOperator(const std::string& type, IOIndex_t nbData, IOIndex_t nbParam, IOIndex_t nbOut, const std::string& name = "") .. doxygenfunction:: Aidge::GenericOperator(const std::string& type, std::shared_ptr op, const std::string& name = "") Meta Operator ------------- A meta-operator (or composite operator) is internally built from a sub-graph. .. tab-set:: :sync-group: language .. tab-item:: Python :sync: python .. autofunction:: aidge_core.meta_operator .. tab-item:: C++ :sync: cpp .. doxygenfunction:: Aidge::MetaOperator Building a new meta-operator is simple: .. code-block:: c++ auto graph = Sequential({ Pad<2>(padding_dims, (!name.empty()) ? name + "_pad" : ""), MaxPooling<2>(kernel_dims, (!name.empty()) ? name + "_maxpooling" : "", stride_dims, ceil_mode) }); return MetaOperator("PaddedMaxPooling2D", graph, name); You can use the :class:`aidge_core.expand_metaops` to flatten the meta-operators in a graph. Predefined operators -------------------- .. jinja:: backend_cpu :file: jinja/predefined_ops.jinja :header_char: =