Skip to content
Snippets Groups Projects
Commit dbf80ab9 authored by Olivier BICHLER's avatar Olivier BICHLER
Browse files

Fixed 2nd output handling

parent 32b1a744
No related branches found
No related tags found
1 merge request!377Add TopK operator
Pipeline #69120 failed
...@@ -94,6 +94,7 @@ public: ...@@ -94,6 +94,7 @@ public:
bool forwardDims(bool allowDataDependency = false) override final; bool forwardDims(bool allowDataDependency = false) override final;
void setBackend(const std::string& name, DeviceIdx_t device = 0) override; void setBackend(const std::string& name, DeviceIdx_t device = 0) override;
void setDataType(const DataType& dataType) const override final;
std::set<std::string> getAvailableBackends() const override; std::set<std::string> getAvailableBackends() const override;
inline std::shared_ptr<Attributes> attributes() const override { return mAttributes; } inline std::shared_ptr<Attributes> attributes() const override { return mAttributes; }
......
...@@ -78,6 +78,8 @@ bool Aidge::TopK_Op::forwardDims(bool allowDataDependency) { ...@@ -78,6 +78,8 @@ bool Aidge::TopK_Op::forwardDims(bool allowDataDependency) {
const auto kAxis = (axis() >= 0) ? axis() : axis() + static_cast<std::int8_t>(outDims.size()); const auto kAxis = (axis() >= 0) ? axis() : axis() + static_cast<std::int8_t>(outDims.size());
outDims[kAxis] = k(); outDims[kAxis] = k();
mOutputs[0]->resize(outDims); mOutputs[0]->resize(outDims);
mOutputs[1]->resize(outDims);
mOutputs[1]->setDataType(DataType::Int64);
return true; return true;
} }
...@@ -87,6 +89,12 @@ bool Aidge::TopK_Op::forwardDims(bool allowDataDependency) { ...@@ -87,6 +89,12 @@ bool Aidge::TopK_Op::forwardDims(bool allowDataDependency) {
void Aidge::TopK_Op::setBackend(const std::string& name, Aidge::DeviceIdx_t device) { void Aidge::TopK_Op::setBackend(const std::string& name, Aidge::DeviceIdx_t device) {
SET_IMPL_MACRO(TopK_Op, *this, name); SET_IMPL_MACRO(TopK_Op, *this, name);
mOutputs[0]->setBackend(name, device); mOutputs[0]->setBackend(name, device);
mOutputs[1]->setBackend(name, device);
}
void Aidge::TopK_Op::setDataType(const DataType& dataType) const {
mOutputs[0]->setDataType(dataType);
// mOutputs[1] data type is fixed (Int64)
} }
std::set<std::string> Aidge::TopK_Op::getAvailableBackends() const { std::set<std::string> Aidge::TopK_Op::getAvailableBackends() const {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment