Skip to content
Snippets Groups Projects
ProducerImpl.hpp 1.66 KiB
Newer Older
Cyril Moineau's avatar
Cyril Moineau committed
/********************************************************************************
 * 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
 *
 ********************************************************************************/

#ifndef __AIDGE_CPU_OPERATOR_PRODUCERIMPL_H__
#define __AIDGE_CPU_OPERATOR_PRODUCERIMPL_H__

#include <memory>

#include "backend/OperatorImpl.hpp"
#include "operator/Producer.hpp"
#include "utils/Registrar.hpp"
#include "utils/Types.h"

namespace Aidge {
class ProducerImpl_cpu : public OperatorImpl {
   private:
    const Producer_Op &mOp;

   public:
    ProducerImpl_cpu(const Producer_Op &op) : mOp(op) {}

    static std::unique_ptr<ProducerImpl_cpu> create(const Producer_Op &op) {
        return std::make_unique<ProducerImpl_cpu>(op);
    }

   public:
    NbElts_t getNbRequiredData(const IOIndex_t inputIdx) const override final;
    NbElts_t getNbRequiredProtected(const IOIndex_t inputIdx) const override final;
    NbElts_t getRequiredMemory(__attribute__((unused)) const IOIndex_t outputIdx, const std::vector<DimSize_t> &inputsSize) const override final;
    NbElts_t getNbConsumedData(const IOIndex_t inputIdx) const override final;
    NbElts_t getNbProducedData(const IOIndex_t outputIdx) const override final;
Cyril Moineau's avatar
Cyril Moineau committed

    void forward();

    void backward();
};

namespace {
static Registrar<Producer_Op> registrarProducer1DImpl_cpu("cpu", Aidge::ProducerImpl_cpu::create);
}  // namespace
}  // namespace Aidge

#endif /* __AIDGE_CPU_OPERATOR_PRODUCERIMPL_H__ */