* @brief Add NNAPI operand from `buffer`, the memory pointed * by `buffer` should be persistent until the execution finished. * No copying. * * @param name The name of operand * @param buffer The address of the buffer * @param operand_type The OperandType of the operand * * @return The index of the added operand */
| 170 | * @return The index of the added operand |
| 171 | */ |
| 172 | ModelBuilder::Index ModelBuilder::AddTensorFromPersistentBuffer( |
| 173 | const string &name, const void *buffer, const OperandType &operand_type) { |
| 174 | DNN_ASSERT(!operand_type.dimensions.empty(), ""); |
| 175 | DNN_ASSERT(!isScalarType(operand_type.type), ""); |
| 176 | uint32_t index = AddNewOperand(operand_type); |
| 177 | THROW_ON_ERROR(nnapi_->ANeuralNetworksModel_setOperandValue( |
| 178 | dnn_model_->model_, index, buffer, GetBytesNumFromOperandType(operand_type) |
| 179 | )); |
| 180 | shaper_.AddShape(name, operand_type.dimensions); |
| 181 | RegisterOperand(name, index, operand_type); |
| 182 | return index; |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * @brief It is the same as `AddTensorFromPersistentBuffer` except |
nothing calls this directly
no test coverage detected