Newer
Older
/********************************************************************************
* 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_CORE_OPERATOR_MATMUL_H_
#define AIDGE_CORE_OPERATOR_MATMUL_H_
#include <array>
#include <cmath>
#include <numeric>
#include <memory>
#include <vector>
#include "aidge/utils/Types.h"
#include "aidge/data/Tensor.hpp"
#include "aidge/graph/Node.hpp"

Maxence Naud
committed
#include "aidge/operator/OperatorTensor.hpp"
#include "aidge/operator/Producer.hpp"
#include "aidge/utils/StaticAttributes.hpp"
#include "aidge/utils/Registrar.hpp"

Maxence Naud
committed
class MatMul_Op : public OperatorTensor,
static const std::string Type;
/**
* @brief Copy-constructor. Copy the operator attributes and its output tensor(s), but not its input tensors (the new operator has no input associated).
* @param op Operator to copy.
*/

Maxence Naud
committed
mImpl = op.mImpl ? Registrar<MatMul_Op>::create(op.mOutputs[0]->getImpl()->backend())(*this) : nullptr;
}
/**
* @brief Clone the operator using its copy-constructor.
std::shared_ptr<Operator> clone() const override {
}
if (!getInput(0)->empty() && !getInput(1)->empty())
{
std::vector<std::size_t> outDims;
for (std::size_t i = 0; i < getInput(0)->nbDims()-1; i++)
{
outDims.push_back(getInput(0)->dims()[i]);

Maxence Naud
committed
}
size_t secondToLastIdx = getInput(1)->nbDims() > 1 ? getInput(1)->nbDims() - 2 : 0;
for (std::size_t i = 0; i < getInput(1)->nbDims(); i++)
{
if(i != secondToLastIdx)
outDims.push_back(getInput(1)->dims()[i]);
}
mOutputs[0]->resize(outDims);
void setBackend(const std::string& name, DeviceIdx_t device = 0) override {
mOutputs[0]->setBackend(name, device);
static const std::vector<std::string> getInputsName(){
}
static const std::vector<std::string> getOutputsName(){
return {"data_output"};
}
inline std::shared_ptr<Node> MatMul(const std::string& name = "") {
return std::make_shared<Node>(std::make_shared<MatMul_Op>(), name);
#endif /* AIDGE_CORE_OPERATOR__MATMUL_H_ */