2022-09-29 11:01:30 +08:00
|
|
|
#pragma once
|
|
|
|
#include "core/operator.h"
|
|
|
|
|
|
|
|
namespace infini {
|
2023-02-13 22:48:20 +08:00
|
|
|
/**
|
|
|
|
* @brief Concatenate several tensors into one. All the input tensors should
|
|
|
|
* have the same shape except for the concatenated dimension.
|
|
|
|
*
|
|
|
|
*/
|
2022-09-29 11:01:30 +08:00
|
|
|
class ConcatObj : public OperatorObj {
|
|
|
|
int dim;
|
|
|
|
|
|
|
|
public:
|
2023-02-13 22:48:20 +08:00
|
|
|
/**
|
|
|
|
* @brief Construct a new Concat object.
|
|
|
|
*
|
|
|
|
* @param graph The computation graph that this operator belongs to.
|
|
|
|
* @param inputs The input tensors to be concatenated.
|
|
|
|
* @param output Concatenated tensor.
|
|
|
|
* @param dim The dimension to concatenate on.
|
|
|
|
*/
|
2022-09-29 11:01:30 +08:00
|
|
|
ConcatObj(GraphObj *graph, TensorVec inputs, Tensor output, int dim);
|
2023-02-12 18:27:52 +08:00
|
|
|
OP_CLONE(ConcatObj);
|
2022-09-29 11:01:30 +08:00
|
|
|
|
2023-11-23 13:11:50 +08:00
|
|
|
optional<vector<Shape>> inferShape(const TensorVec &inputs) override;
|
2022-09-29 11:01:30 +08:00
|
|
|
|
|
|
|
std::string toString() const override;
|
|
|
|
int numInputs() const override { return inputs.size(); }
|
|
|
|
int numOutputs() const override { return 1; }
|
|
|
|
int getDim() const { return dim; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
vector<int> getWorkloadVector() const override;
|
|
|
|
vector<int> getOpAttrVector() const override;
|
|
|
|
};
|
2022-10-15 16:29:28 +08:00
|
|
|
} // namespace infini
|