MSTensor

View Source On Gitee

import com.mindspore.lite.MSTensor;

MSTensor defined tensor in MindSpore Lite.

Public Member Functions

function

int[] getShape()

int getDataType()

byte[] getByteData()

float[] getFloatData()

int[] getIntData()

long[] getLongData()

void setData(byte[] data)

void setData(ByteBuffer data)

long size()

int elementsNum()

void free()

getShape

public int[] getShape()

Get the shape of the MindSpore Lite MSTensor.

  • Returns

    A array of int as the shape of the MindSpore Lite MSTensor.

getDataType

public int getDataType()

DataType is defined in com.mindspore.lite.DataType.

  • Returns

    The MindSpore Lite data type of the MindSpore Lite MSTensor class.

getByteData

public byte[] getByteData()

Get output data of MSTensor, the data type is byte.

  • Returns

    The byte array containing all MSTensor output data.

getFloatData

public float[] getFloatData()

Get output data of MSTensor, the data type is float.

  • Returns

    The float array containing all MSTensor output data.

getIntData

public int[] getIntData()

Get output data of MSTensor, the data type is int.

  • Returns

    The int array containing all MSTensor output data.

getLongData

public long[] getLongData()

Get output data of MSTensor, the data type is long.

  • Returns

    The long array containing all MSTensor output data.

setData

public void setData(byte[] data)

Set the input data of MSTensor.

  • Parameters

    • data: Input data of byte[] type.

public void setData(ByteBuffer data)

Set the input data of MSTensor.

  • Parameters

    • data: Input data of ByteBuffer type.

size

public long size()

Get the size of the data in MSTensor in bytes.

  • Returns

    The size of the data in MSTensor in bytes.

elementsNum

public int elementsNum()

Get the number of elements in MSTensor.

  • Returns

    The number of elements in MSTensor.

free

public void free()

Free all temporary memory in MindSpore Lite MSTensor.