2022-09-29 14:44:20 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "core/operator.h"
|
|
|
|
|
|
|
|
namespace infini {
|
|
|
|
class GatherObj : public OperatorObj {
|
|
|
|
int axis;
|
|
|
|
|
|
|
|
public:
|
|
|
|
GatherObj(GraphObj *graph, Tensor input, Tensor index, Tensor output,
|
|
|
|
int axis);
|
2023-02-12 18:27:52 +08:00
|
|
|
OP_CLONE(GatherObj);
|
2022-09-29 14:44:20 +08:00
|
|
|
std::string toString() const override;
|
|
|
|
int numInputs() const override { return 2; }
|
|
|
|
int numOutputs() const override { return 1; }
|
|
|
|
optional<vector<Shape>> inferShape(const TensorVec &inputs) const override;
|
|
|
|
int getAxis() const { return axis; }
|
|
|
|
vector<DataType> inferDataType(const TensorVec &inputs) const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool CheckIndexValid() const;
|
|
|
|
vector<int> getWorkloadVector() const override;
|
|
|
|
vector<int> getOpAttrVector() const override;
|
|
|
|
};
|
2022-10-15 16:29:28 +08:00
|
|
|
} // namespace infini
|