Help Center/
Atlas 300 Application (Model 3000)/
Matrix API Reference/
Model Manager APIs (C++ Language)/
Data Types/
IAITensor
Updated on 2022-03-13 GMT+08:00
IAITensor
Serves as the input and output of a model when the process function is used. This data type is defined in ai_tensor.h.
/** * Tensor Input and output data */ class IAITensor { public: IAITensor() {} virtual ~IAITensor() {}; /* * @brief Set parameters through AITensorDescription. * @param [in] tensor_desc Tensor description * @return true: Initialization success * @return false: Initialization failure. The possible cause is that tensor_desc is inconsistent with the current tensor. */ virtual bool Init(const AITensorDescription &tensor_desc) = 0; /* * @brief Obtain the type name. */ virtual const char* const GetTypeName() = 0; /* * @brief Obtain the byte length after serialization. */ virtual uint32_t ByteSizeLong() = 0; virtual void SetBufferAttr(void *data, int32_t size, bool isowner, bool is_support_mem_share) = 0; virtual bool IsSupportZerocpy() = 0; #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. */ virtual AIStatus SerializeTo(void* buffer, const uint32_t size) = 0; /* * @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. */ virtual AIStatus DeserializeFrom(const void* buffer, const uint32_t size) = 0; #endif };
Parent topic: Data Types
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