Forked from
Eclipse Projects / aidge / aidge_backend_cpu
322 commits behind, 1 commit ahead of the upstream repository.
-
Grégoire Kubler authoredGrégoire Kubler authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
ConstantOfShapeImpl.cpp 1.34 KiB
/********************************************************************************
* Copyright (c) 2024 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 "aidge/backend/cpu/operator/ConstantOfShapeImpl.hpp"
#include <functional>
#include <memory>
#include <vector>
#include "aidge/backend/cpu/operator/ConstantOfShapeImpl_forward_kernels.hpp"
#include "aidge/data/Data.hpp"
#include "aidge/data/Tensor.hpp"
#include "aidge/operator/ConstantOfShape.hpp"
#include "aidge/utils/ErrorHandling.hpp"
#include "aidge/utils/Registrar.hpp"
#include "aidge/utils/Types.h"
void Aidge::ConstantOfShapeImpl_cpu::forward() {
const ConstantOfShape_Op &op_ = static_cast<const ConstantOfShape_Op &>(mOp);
// Check if input is provided
AIDGE_ASSERT(op_.getInput(0), "{} : Missing input 0", __func__);
// Create the forward kernal with the wanted types
auto kernelFunc = Registrar<ConstantOfShapeImplForward_cpu>::create(
{op_.getOutput(0)->dataType()});
// Call kernel
kernelFunc(op_.getOutput(0)->dims(),
op_.value(),
op_.getOutput(0)->getImpl()->rawPtr());
}