import com.mindspore.MSTensor;
MSTensor defined tensor in MindSpore.
public static MSTensor createTensor(String tensorName, int dataType, int[] tensorShape, ByteBuffer buffer)
Create MindSpore MSTensor.
Parameters
tensorName
: tensor name.dataType
: tensor data type.tensorShape
: tensor shape.buffer
: tensor data buffer.Returns
MindSpore MSTensor.
public int[] getShape()
Get the shape of the MindSpore MSTensor.
Returns
A array of int as the shape of the MindSpore MSTensor.
public int getDataType()
DataType is defined in com.mindspore.DataType.
Returns
The MindSpore data type of the MindSpore MSTensor class.
public byte[] getByteData()
Get output data of MSTensor, the data type is byte.
Returns
The byte array containing all MSTensor output data.
public float[] getFloatData()
Get output data of MSTensor, the data type is float.
Returns
The float array containing all MSTensor output data.
public int[] getIntData()
Get output data of MSTensor, the data type is int.
Returns
The int array containing all MSTensor output data.
public long[] getLongData()
Get output data of MSTensor, the data type is long.
Returns
The long array containing all MSTensor output data.
public void setData(byte[] data)
Set the input data of MSTensor.
Parameters
data
: Input data of byte[] type.public void setData(float[] data)
Set the input data of MSTensor.
Parameters
data
: Input data of float[] type.public void setData(ByteBuffer data)
Set the input data of MSTensor.
Parameters
data
: Input data of ByteBuffer type.public long size()
Get the size of the data in MSTensor in bytes.
Returns
The size of the data in MSTensor in bytes.
public int elementsNum()
Get the number of elements in MSTensor.
Returns
The number of elements in MSTensor.
public void free()
Free all temporary memory in MindSpore MSTensor.
public String tensorName()
Get tensor name.
Returns
Tensor name.
import com.mindspore.config.DataType;
Define tensor data type.
public static final int kNumberTypeBool = 30;
public static final int kNumberTypeInt = 31;
public static final int kNumberTypeInt8 = 32;
public static final int kNumberTypeInt16 = 33;
public static final int kNumberTypeInt32 = 34;
public static final int kNumberTypeInt64 = 35;
public static final int kNumberTypeUInt = 36;
public static final int kNumberTypeUInt8 = 37;
public static final int kNumberTypeUInt16 = 38;
public static final int kNumberTypeUint32 = 39;
public static final int kNumberTypeUInt64 = 40;
public static final int kNumberTypeFloat = 41;
public static final int kNumberTypeFloat16 = 42;
public static final int kNumberTypeFloat32 = 43;
public static final int kNumberTypeFloat64 = 44;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。