Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/********************************************************************************
* 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>
#include <vector>
#include "data/Tensor.hpp"
#include "operator/Producer.hpp"
#include "utils/Types.h"
#include "operator/ProducerImpl.hpp"
std::size_t Aidge::ProducerImpl_cpu::getNbRequiredData(
Aidge::IOIndex_t /*inputIdx*/) const
{
return 0;
}
Aidge::DimSize_t Aidge::ProducerImpl_cpu::getNbConsumedData(
Aidge::IOIndex_t /*inputIdx*/) const
{
return 0;
}
std::size_t Aidge::ProducerImpl_cpu::getNbRequiredProtected(
Aidge::IOIndex_t /*inputIdx*/) const
{
return 0;
}
std::size_t Aidge::ProducerImpl_cpu::getRequiredMemory(
const IOIndex_t outputIdx, const std::vector<DimSize_t> &inputsSize) const
{
// Requires the whole tensors, regardless of available data on inputs
assert(outputIdx == 0 && "operator has only one output");
const auto &outputDims = std::static_pointer_cast<Tensor>(mOp.getOutput(0))->dims();
return std::accumulate(
outputDims.begin(),
outputDims.end(),
NbElts_t(1),
std::multiplies<NbElts_t>());
}
Aidge::DimSize_t Aidge::ProducerImpl_cpu::getNbProducedData(
Aidge::IOIndex_t /*outputIdx*/) const
{
return getRequiredMemory(0, {});
}
void Aidge::ProducerImpl_cpu::forward()
{
}
void Aidge::ProducerImpl_cpu::backward()
{
printf("Not implemented yet.\n");
}