// Generate output operand and permute operation
auto out_operand_index = addOperand(operand.shape(), operand.typeInfo());
auto &out_operand = _operands.at(out_operand_index);
+ // change model output if operand_index is model output index
+ auto &model_outputs = getOutputs();
+ if (model_outputs.contains(operand_index))
+ {
+ model_outputs.replace(operand_index, out_operand_index);
+ }
out_operand.setAsOperationOutput();
auto out_operand_li = nnfw::make_unique<operand::LowerInfo>(operand::asShape4D(operand.shape()));
out_operand_li->addDefBackend(backend);
}
});
+ // Add def backend to model input/output operand as default backend
+ for (uint32_t n = 0; n < getInputs().size(); ++n)
+ {
+ operand::IO::Index input_index{n};
+
+ operand::Index index{getInputs().at(input_index)};
+ auto &&lower_info = operands_lower_info.at(index);
+
+ lower_info->addDefBackend(_backend_resolver->getDefaultBackend());
+ }
+
+ for (uint32_t n = 0; n < getOutputs().size(); ++n)
+ {
+ operand::IO::Index output_index{n};
+
+ operand::Index index{getOutputs().at(output_index)};
+ auto &&lower_info = operands_lower_info.at(index);
+
+ lower_info->addUseBackend(_backend_resolver->getDefaultBackend());
+ }
+
// Set LowerInfo for each operand from the operand::LowerInfo holder
_operands.iterate([&](const operand::Index &index, operand::Object &object) {
object.lower_info(std::move(operands_lower_info[index]));
public:
const operand::IndexSet &getInputs() const { return _inputs; }
const operand::IndexSet &getOutputs() const { return _outputs; }
+ operand::IndexSet &getOutputs() { return _outputs; }
const operand::Set &operands() const { return _operands; }
operand::Set &operands() { return _operands; } // TODO Remove this non-const accessor
const operation::Set &operations() const { return _operations; }