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

Add forwardDType to MetaOperator operator.

parent a992d818
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ namespace Aidge {
/**
* @class MetaOperator_Op
* @brief Represents a meta-operator, which is a composition of multiple operators.
*
*
* A meta-operator encapsulates a micro-graph of operations, facilitating modularity
* and reusability. It extends the functionality of `OperatorTensor` and provides
* features such as cloning, dynamic input association, and custom backend support.
......@@ -55,7 +55,7 @@ private:
public:
/**
* @brief Constructor for MetaOperator_Op.
*
*
* @param type The type of the meta-operator.
* @param graph The micro-graph defining the meta-operator.
* @param forcedInputsCategory Optional input categories to override default behavior.
......@@ -64,16 +64,16 @@ public:
/**
* @brief Copy constructor.
*
*
* Copies the operator's attributes and output tensors, but not its input tensors.
*
*
* @param op The operator to copy.
*/
MetaOperator_Op(const MetaOperator_Op& op);
/**
* @brief Set the node for scheduling.
*
*
* @param node The node to be used as the upper node in the scheduling hierarchy.
*/
inline void setUpperNode(std::shared_ptr<Node> node) {
......@@ -82,16 +82,16 @@ public:
/**
* @brief Clone this meta-operator.
*
*
* Uses the copy constructor to create a new instance with identical attributes.
*
*
* @return A shared pointer to the cloned operator.
*/
std::shared_ptr<Operator> clone() const override;
/**
* @brief Retrieve the micro-graph defining the meta-operator.
*
*
* @return A shared pointer to the micro-graph.
*/
inline const std::shared_ptr<GraphView>& getMicroGraph() const noexcept {
......@@ -100,7 +100,7 @@ public:
/**
* @brief Retrieve the scheduler for the micro-graph.
*
*
* @return A shared pointer to the scheduler.
*/
inline const std::shared_ptr<SequentialScheduler>& getMicroGraphScheduler() const noexcept {
......@@ -109,7 +109,7 @@ public:
/**
* @brief Associate an input tensor to the operator.
*
*
* @param inputIdx Index of the input tensor.
* @param data Shared pointer to the data tensor.
*/
......@@ -117,7 +117,7 @@ public:
/**
* @brief Set an input tensor for the operator.
*
*
* @param inputIdx Index of the input tensor.
* @param data Shared pointer to the data tensor.
*/
......@@ -125,7 +125,7 @@ public:
/**
* @brief Forward the dimensions through the micro-graph.
*
*
* @param allowDataDependency If true, allows data-dependent operations during forwarding.
* @return True if the operation succeeded, false otherwise.
*/
......@@ -137,16 +137,31 @@ public:
return false;
}
/**
* @brief Forward the data type through the micro-graph.
*
* @return True if the operation succeeded, false otherwise.
*/
bool forwardDType() override final {
if (inputsAssociated(false)) {
// Forward dims of micro-graph
return mGraph->forwardDType({});
}else{
Log::warn("No input associated to metaoperator.");
}
return false;
}
/**
* @brief Retrieve the backend for the operator.
*
*
* @return The name of the backend.
*/
std::string backend() const noexcept override;
/**
* @brief Set the backend for the operator.
*
*
* @param name The name of the backend.
* @param device The device index.
*/
......@@ -154,16 +169,16 @@ public:
/**
* @brief Get the available backends for the operator.
*
*
* @return A set of available backend names.
*/
std::set<std::string> getAvailableBackends() const override;
/**
* @brief Set the data type for the operator.
*
*
* This propagates the data type change to the micro-graph.
*
*
* @param datatype The new data type.
*/
void setDataType(const DataType &datatype) const override {
......@@ -175,7 +190,7 @@ public:
/**
* @brief Retrieve the dynamic attributes of the operator.
*
*
* @return A shared pointer to the attributes.
*/
inline std::shared_ptr<Attributes> attributes() const override { return mAttributes; }
......@@ -207,7 +222,7 @@ public:
void backward() override;
/**
* @brief Check if the operator is atomic.
*
*
* @return False, as meta-operators are inherently non-atomic.
*/
inline bool isAtomic() const noexcept override final { return false; }
......@@ -216,7 +231,7 @@ public:
/**
* @brief Helper function to create a MetaOperator node.
*
*
* @param type The type of the meta-operator.
* @param graph The micro-graph defining the meta-operator.
* @param forcedInputsCategory Optional input categories to override default behavior.
......
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