Skip to content
Snippets Groups Projects
Commit 1ae93537 authored by Olivier BICHLER's avatar Olivier BICHLER
Browse files

Added Producer impl

parent adb33744
No related branches found
No related tags found
No related merge requests found
......@@ -14,5 +14,6 @@
#include "aidge/backend/cuda/data/TensorImpl.hpp"
#include "aidge/backend/cuda/operator/ConvImpl.hpp"
#include "aidge/backend/cuda/operator/ProducerImpl.hpp"
#endif /* AIDGE_BACKEND_CUDA_IMPORTS_H_ */
\ No newline at end of file
/********************************************************************************
* 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_CUDA_OPERATOR_PRODUCERIMPL_H_
#define AIDGE_CUDA_OPERATOR_PRODUCERIMPL_H_
#include <memory>
#include "aidge/backend/OperatorImpl.hpp"
#include "aidge/operator/Producer.hpp"
#include "aidge/utils/Registrar.hpp"
#include "aidge/utils/Types.h"
namespace Aidge {
class ProducerImpl_cuda : public OperatorImpl {
public:
ProducerImpl_cuda(const Producer_Op &op) : OperatorImpl(op) {}
static std::unique_ptr<ProducerImpl_cuda> create(const Producer_Op &op) {
return std::make_unique<ProducerImpl_cuda>(op);
}
NbElts_t getNbProducedData(const IOIndex_t outputIdx) const override final;
void forward() override;
};
namespace {
static Registrar<Producer_Op> registrarProducerImpl_cuda("cuda", Aidge::ProducerImpl_cuda::create);
} // namespace
} // namespace Aidge
#endif /* AIDGE_CUDA_OPERATOR_PRODUCERIMPL_H_ */
/********************************************************************************
* 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
*
********************************************************************************/
#include <cassert>
#include <numeric> // std::accumulate
#include <vector>
#include "aidge/data/Tensor.hpp"
#include "aidge/operator/Producer.hpp"
#include "aidge/utils/Types.h"
#include "aidge/backend/cuda/operator/ProducerImpl.hpp"
Aidge::DimSize_t Aidge::ProducerImpl_cuda::getNbProducedData(
Aidge::IOIndex_t outputIdx) const
{
// Requires the whole tensors, regardless of available data on inputs
assert(outputIdx == 0 && "operator has only one output");
(void) outputIdx;
return std::static_pointer_cast<Tensor>(mOp.getRawOutput(0))->size();
}
void Aidge::ProducerImpl_cuda::forward()
{
}
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