MCPcopy Create free account
hub / github.com/JDAI-CV/DNNLibrary / AddTensorFromPersistentBuffer

Method AddTensorFromPersistentBuffer

dnnlibrary/ModelBuilder.cpp:172–183  ·  view source on GitHub ↗

* @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 */

Source from the content-addressed store, hash-verified

170 * @return The index of the added operand
171 */
172ModelBuilder::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

Callers

nothing calls this directly

Calls 3

isScalarTypeFunction · 0.85
AddShapeMethod · 0.80

Tested by

no test coverage detected