AITensorFactory::CreateTensor
Creates a model tensor. This API is defined in ai_tensor.h.
Syntax
std::shared_ptr<IAITensor> CreateTensor(const AITensorDescription &tensor_desc, void *buffer, int32_t size);
std::shared_ptr<IAITensor> CreateTensor(const AITensorDescription &tensor_desc);
std::shared_ptr<IAITensor> CreateTensor(const std::string &type);
Parameter Description
Parameter |
Description |
Value Range |
---|---|---|
tensor_desc |
Tensor description For details about the syntax of the AITensorDescription data type, see AITensorDescription. |
- |
buffer |
Data address
NOTE:
|
- |
size |
Data length
NOTE:
The unit is byte. The value of size must be the same as the actual data size. |
- |
type |
Type of registering a tensor Note: This API should be used only when no memory is pre-allocated. For details, see the description of type in AITensorDescription. |
- |
Return Value
If a model tensor is created successfully, the tensor pointer is returned. If a model tensor fails to be created, a null pointer is returned.
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.
For any further questions, feel free to contact us through the chatbot.
Chatbot