2022-09-29 11:01:30 +08:00
|
|
|
#pragma once
|
|
|
|
#include "core/operator.h"
|
|
|
|
|
|
|
|
namespace infini {
|
|
|
|
class SplitObj : public OperatorObj {
|
|
|
|
int dim, num; // split dim;Average split num or outputs size
|
|
|
|
vector<int> ratio; // output dim ratio
|
|
|
|
public:
|
|
|
|
SplitObj(GraphObj *graph, Tensor input, std::optional<TensorVec> outputs,
|
|
|
|
int dim, int num);
|
|
|
|
SplitObj(GraphObj *graph, Tensor input, std::optional<TensorVec> outputs,
|
|
|
|
int dim, const vector<int> &ratio);
|
2023-02-12 18:27:52 +08:00
|
|
|
OP_CLONE(SplitObj);
|
2022-09-29 11:01:30 +08:00
|
|
|
|
|
|
|
optional<vector<Shape>> inferShape(const TensorVec &inputs) const override;
|
|
|
|
|
|
|
|
std::string toString() const override;
|
|
|
|
int numInputs() const override { return 1; }
|
|
|
|
int numOutputs() const override { return num; }
|
|
|
|
int getDim() const { return dim; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
vector<int> getWorkloadVector() const override;
|
|
|
|
vector<int> getOpAttrVector() const override;
|
|
|
|
};
|
|
|
|
} // namespace infini
|