MindSpore张量mindspore::tensor
MindSpore張量mindspore::tensor
MSTensor
#include <ms_tensor.h>
MSTensor定義了MindSpore Lite中的張量。
構造函數和析構函數
MSTensor
MSTensor()
MindSpore Lite MSTensor的構造函數。
? 返回值
MindSpore Lite MSTensor的實例。
~MSTensor
virtual ~MSTensor()
MindSpore Lite Model的析構函數。
公有成員函數
data_type
virtual TypeId data_type() const
獲取MindSpore Lite MSTensor的數據類型。
TypeId在mindspore/mindspore/core/ir/dtype/type_id.h中定義。只有TypeId枚舉中的數字類型或kObjectTypeString可用于MSTensor。
? 返回值
MindSpore Lite MSTensor類的MindSpore Lite TypeId。
shape
virtual std::vector shape() const
獲取MindSpore Lite MSTensor的形狀。
? 返回值
一個包含MindSpore Lite MSTensor形狀數值的整型向量。
DimensionSize
virtual int DimensionSize(size_t index) const
通過參數索引獲取MindSpore Lite MSTensor的維度的大小。
? 參數
o index: 定義了返回的維度的索引。
? 返回值
MindSpore Lite MSTensor的維度的大小。
ElementsNum
virtual int ElementsNum() const
獲取MSTensor中的元素個數。
? 返回值
MSTensor中的元素個數
Size
virtual size_t Size() const
獲取MSTensor中的數據的字節數大小。
? 返回值
MSTensor中的數據的字節數大小。
MutableData
virtual void *MutableData() const
獲取MSTensor中的數據的指針。
該數據指針可用于對MSTensor中的數據進行讀取和寫入。
? 返回值
指向MSTensor中的數據的指針。
總結
以上是生活随笔為你收集整理的MindSpore张量mindspore::tensor的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MindSpore技术理解(下)
- 下一篇: MindSpore基准性能