node.getOutputs().at(model::operation::TopKV2::Output::OUTPUT_INDICES)};
const auto inputData_index{node.getInputs().at(model::operation::TopKV2::Input::INPUT)};
- const auto k_index{node.param().k_index};
// Currently, we only support the vector input.
assert(_ctx.at(inputData_index).shape().rank() == 1 ||
_ctx.at(inputData_index).shape().rank() == 2);
- const auto k = _ctx.at(k_index).asScalar<int32_t>();
+ const auto k = node.param().k;
auto values_alloc = _tensor_builder->at(outputValues_index).get();
auto indices_alloc = _tensor_builder->at(outputIndices_index).get();
};
_map[ANEURALNETWORKS_TOPK_V2_EX] = [](const OperationFactory::Param &init_param,
- neurun::model::Operands &) {
+ neurun::model::Operands &operands) {
assert(init_param.input_count == 2 && init_param.output_count == 2);
// Each output should be interpreted as follows:
OperandIndexSequence inputs{init_param.inputs[0]};
operation::TopKV2::Param param;
- param.k_index = OperandIndex{init_param.inputs[1]};
+ param.k = operands.at(OperandIndex{init_param.inputs[1]}).asScalar<std::int32_t>();
return new operation::TopKV2{inputs, outputs, param};
};