Skip to content
Snippets Groups Projects

Added default operator impl with default producer-consumer model

Merged Olivier BICHLER requested to merge simpl_op_impl into main
2 files
+ 93
9
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -18,11 +18,13 @@
#include "aidge/utils/Types.h"
namespace Aidge {
class Operator;
class OperatorImpl {
public:
virtual void forward(){};
virtual void backward(){};
OperatorImpl(const Operator& op);
virtual void forward();
virtual void backward();
/**
* @brief Minimum amount of data from a specific input required by the
@@ -31,13 +33,13 @@ public:
* @param inputIdx Index of the input analysed.
* @return std::size_t
*/
virtual NbElts_t getNbRequiredData(const IOIndex_t inputIdx) const = 0;
virtual NbElts_t getNbRequiredData(const IOIndex_t inputIdx) const;
// Amount of input data that cannot be overwritten during the execution.
virtual NbElts_t getNbRequiredProtected(const IOIndex_t inputIdx) const = 0;
virtual NbElts_t getNbRequiredProtected(const IOIndex_t inputIdx) const;
// Memory required at an output for a given input size.
virtual NbElts_t getRequiredMemory(const IOIndex_t outputIdx, const std::vector<DimSize_t> &inputsSize) const = 0;
virtual NbElts_t getRequiredMemory(const IOIndex_t outputIdx, const std::vector<DimSize_t> &inputsSize) const;
/**
* @brief Total amount of consumed data from a specific input.
@@ -45,7 +47,7 @@ public:
* @param inputIdx Index of the input analysed.
* @return DimSize_t
*/
virtual NbElts_t getNbConsumedData(const IOIndex_t inputIdx) const = 0;
virtual NbElts_t getNbConsumedData(const IOIndex_t inputIdx) const;
/**
* @brief Total amount of produced data ready to be used on a specific output.
@@ -53,15 +55,20 @@ public:
* @param outputIdx Index of the output analysed.
* @return DimSize_t
*/
virtual NbElts_t getNbProducedData(const IOIndex_t outputIdx) const = 0;
virtual NbElts_t getNbProducedData(const IOIndex_t outputIdx) const;
/**
* @brief Update the Consummer Producer system by simulating the consumption and production of i/o
*
*/
virtual void updateConsummerProducer() = 0;
virtual void updateConsummerProducer();
virtual ~OperatorImpl() = default;
protected:
const Operator &mOp;
std::vector<NbElts_t> mNbConsumedData;
std::vector<NbElts_t> mNbProducedData;
};
} // namespace Aidge
Loading