Program Listing for File tensor_c.h

Return to documentation for file (include/runtime/include/c_api/tensor_c.h)

#ifndef MINDSPORE_INCLUDE_C_API_TENSOE_C_H
#define MINDSPORE_INCLUDE_C_API_TENSOE_C_H

#include <stddef.h>
#include "include/c_api/types_c.h"
#include "include/c_api/data_type_c.h"
#include "include/c_api/format_c.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef void *MSTensorHandle;

MS_API MSTensorHandle MSTensorCreate(const char *name, MSDataType type, const int64_t *shape, size_t shape_num,
                                     const void *data, size_t data_len);

MS_API void MSTensorDestroy(MSTensorHandle *tensor);

MS_API MSTensorHandle MSTensorClone(MSTensorHandle tensor);

MS_API void MSTensorSetName(MSTensorHandle tensor, const char *name);

MS_API const char *MSTensorGetName(const MSTensorHandle tensor);

MS_API void MSTensorSetDataType(MSTensorHandle tensor, MSDataType type);

MS_API MSDataType MSTensorGetDataType(const MSTensorHandle tensor);

MS_API void MSTensorSetShape(MSTensorHandle tensor, const int64_t *shape, size_t shape_num);

MS_API const int64_t *MSTensorGetShape(const MSTensorHandle tensor, size_t *shape_num);

MS_API void MSTensorSetFormat(MSTensorHandle tensor, MSFormat format);

MS_API MSFormat MSTensorGetFormat(const MSTensorHandle tensor);

MS_API void MSTensorSetData(MSTensorHandle tensor, void *data);

MS_API const void *MSTensorGetData(const MSTensorHandle tensor);

MS_API void *MSTensorGetMutableData(const MSTensorHandle tensor);

MS_API int64_t MSTensorGetElementNum(const MSTensorHandle tensor);

MS_API size_t MSTensorGetDataSize(const MSTensorHandle tensor);

#ifdef __cplusplus
}
#endif
#endif  // MINDSPORE_INCLUDE_C_API_TENSOE_C_H