Help Center/
Atlas 300 Application (Model 3000)/
Matrix API Reference/
Model Manager APIs (C++ Language)/
Other Compilation Dependent APIs/
AINeuralNetworkBuffer
Updated on 2022-03-13 GMT+08:00
AINeuralNetworkBuffer
Defines the general buffer of the NN. This class is defined in ai_tensor.h.
class AINeuralNetworkBuffer : public AISimpleTensor { public: AINeuralNetworkBuffer() { data_type_ = 0; number_ = 1; channel_ = 1; height_ = 1; width_ = 1; name_ = ""; }; ~AINeuralNetworkBuffer() {}; /* * @brief Obtain the type name. */ const char* const GetTypeName(); /* @brief Obtain the byte size. */ uint32_t ByteSizeLong(); /* @brief Initialization @param [in] tensor_desc Tensor description */ bool Init(const AITensorDescription &tensor_desc); #if defined( __ANDROID__) || defined(ANDROID) /* * @brief Serialize data to the buffer for cross-process data interaction. * @param [in] buffer Address of the buffer to which the data is serialized, allocated by the caller * @param [in] size Size of the buffer to which the data is output * @return SUCCESS Success * FAILED: failure. If the tensor does not support cross-process, this API does not need to be implemented and a failure message is returned. */ AIStatus SerializeTo(void* buffer, uint32_t size_); /* * @brief Deserialize data from the buffer to a tensor for cross-process data interaction. * @param [in] buffer Size of the buffer to which the data is input * @param [in] size Size of the buffer to which the data is input * @return SUCCESS Success * FAILED: failure. If the tensor does not support cross-process, this API does not need to be implemented and a failure message is returned. */ AIStatus DeserializeFrom(const void* buffer, uint32_t size_); #endif /* * @brief Obtain the description. */ static AITensorDescription GetDescription( const std::string &size = "0",const std::string &data_type="0", const std::string &number="0", const std::string &channel="0", const std::string &height="0", const std::string &width="0"); /* @brief Create a tensor. */ static std::shared_ptr<IAITensor> CreateTensor(const AITensorDescription& tensor_desc); /* @brief Obtain the number. */ int32_t GetNumber(); /* @brief Set the number. */ void SetNumber(int32_t number); /* @brief Obtain the number of channels. */ int32_t GetChannel(); /* @brief Set the channel. */ void SetChannel(int32_t channel); /* @brief Obtain the height. */ int32_t GetHeight(); /* @brief Set the height. */ void SetHeight(int32_t height); /* @brief Obtain the width. */ int32_t GetWidth(); /* @brief Set the width. */ void SetWidth(int32_t width); /* @brief Obtain the data type. */ int32_t GetData_type(); /* @brief Set the data type. */ void SetData_type(int32_t data_type); /* @brief Obtain the data type. */ const std::string& GetName() const; /* @brief Set the data type. */ void SetName(const std::string& value); private: int32_t data_type_; int32_t number_; int32_t channel_; int32_t height_; int32_t width_; std::string name_; };
Parent topic: Other Compilation Dependent APIs
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot