1 /* 2 * Copyright (c) Qualcomm Innovation Center, Inc. 3 * All rights reserved. 4 * 5 * This source code is licensed under the BSD-style license found in the 6 * LICENSE file in the root directory of this source tree. 7 */ 8 #include <executorch/backends/qualcomm/aot/wrappers/OpWrapper.h> 9 namespace executorch { 10 namespace backends { 11 namespace qnn { GetOpConfig()12Qnn_OpConfig_t OpWrapper::GetOpConfig() { 13 param_types_.clear(); 14 input_tensor_structs_.clear(); 15 output_tensor_structs_.clear(); 16 17 for (const auto& param_wrapper : params_) { 18 param_types_.emplace_back(param_wrapper->GetQnnParam()); 19 } 20 for (const auto& tensor_wrapper : input_tensors_) { 21 input_tensor_structs_.emplace_back(tensor_wrapper->CloneTensorStruct()); 22 } 23 24 for (const auto& tensor_wrapper : output_tensors_) { 25 output_tensor_structs_.emplace_back(tensor_wrapper->CloneTensorStruct()); 26 } 27 28 Qnn_OpConfig_t ret = QNN_OPCONFIG_INIT; 29 ret.version = QNN_OPCONFIG_VERSION_1; 30 Qnn_OpConfigV1_t& op_config = ret.v1; 31 32 op_config.name = name_.c_str(); 33 op_config.packageName = package_name_.c_str(); 34 op_config.typeName = op_type_.c_str(); 35 op_config.numOfParams = static_cast<std::uint32_t>(param_types_.size()); 36 op_config.params = param_types_.data(); 37 op_config.numOfInputs = 38 static_cast<std::uint32_t>(input_tensor_structs_.size()); 39 op_config.inputTensors = input_tensor_structs_.data(); 40 op_config.numOfOutputs = 41 static_cast<std::uint32_t>(output_tensor_structs_.size()); 42 op_config.outputTensors = output_tensor_structs_.data(); 43 44 return ret; 45 } 46 } // namespace qnn 47 } // namespace backends 48 } // namespace executorch 49