java.lang.Object
uk.ac.manchester.tornado.api.types.arrays.TornadoNativeArray
uk.ac.manchester.tornado.api.types.tensors.Tensor
uk.ac.manchester.tornado.api.types.tensors.TensorInt32
TensorInt32 relies on preview features of the Java platform:
TensorInt32refers to one or more preview APIs:MemorySegment.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
-
Field Summary
Fields inherited from class uk.ac.manchester.tornado.api.types.arrays.TornadoNativeArray
ARRAY_HEADER -
Constructor Summary
ConstructorsConstructorDescriptionTensorInt32(Shape shape) The memory segment representing the tensor data in native memory. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidclear()Clears the contents of the native array.static TensorInt32concat(TensorInt32... arrays) Concatenates multipleTensorInt32instances into a singleTensorInt32.intget(int index) Gets the half_float value stored at the specified index of theHalfFloatArrayinstance.getDType()intlongReturns the number of bytes of theMemorySegmentPREVIEW, excluding the header bytes.longReturns the total number of bytes that theMemorySegmentPREVIEW occupies, including the header bytes.Returns the underlyingMemorySegmentPREVIEW of the native array, without the Tornado Array header.Returns the underlyingMemorySegmentPREVIEW of the native array, including the header.getShape()intgetSize()Returns the number of elements stored in the native array.voidinit(int value) static voidinitialize(TensorInt32 tensor, int value) voidset(int index, int value)
-
Constructor Details
-
TensorInt32
The memory segment representing the tensor data in native memory.
-
-
Method Details
-
init
public void init(int value) -
set
public void set(int index, int value) -
get
public int get(int index) Gets the half_float value stored at the specified index of theHalfFloatArrayinstance.- Parameters:
index- The index of which to retrieve the float value.- Returns:
-
getSize
public int getSize()Description copied from class:TornadoNativeArrayReturns the number of elements stored in the native array.- Specified by:
getSizein classTornadoNativeArray- Returns:
- The number of elements of the native data array.
-
getSegment
Description copied from class:TornadoNativeArrayReturns the underlyingMemorySegmentPREVIEW of the native array, without the Tornado Array header.- Specified by:
getSegmentin classTornadoNativeArray- Returns:
- The
MemorySegmentPREVIEW associated with the native array instance.
-
getSegmentWithHeader
Description copied from class:TornadoNativeArrayReturns the underlyingMemorySegmentPREVIEW of the native array, including the header.- Specified by:
getSegmentWithHeaderin classTornadoNativeArray- Returns:
- The
MemorySegmentPREVIEW associated with the native array instance.
-
getNumBytesOfSegmentWithHeader
public long getNumBytesOfSegmentWithHeader()Description copied from class:TornadoNativeArrayReturns the total number of bytes that theMemorySegmentPREVIEW occupies, including the header bytes.- Specified by:
getNumBytesOfSegmentWithHeaderin classTornadoNativeArray- Returns:
- The total number of bytes of the
MemorySegmentPREVIEW.
-
getNumBytesOfSegment
public long getNumBytesOfSegment()Description copied from class:TornadoNativeArrayReturns the number of bytes of theMemorySegmentPREVIEW, excluding the header bytes.- Specified by:
getNumBytesOfSegmentin classTornadoNativeArray- Returns:
- The number of bytes of the raw data in the
MemorySegmentPREVIEW.
-
clear
protected void clear()Description copied from class:TornadoNativeArrayClears the contents of the native array.- Specified by:
clearin classTornadoNativeArray
-
getElementSize
public int getElementSize()- Specified by:
getElementSizein classTornadoNativeArray
-
getShape
-
getDTypeAsString
- Specified by:
getDTypeAsStringin classTensor
-
getDType
-
getIntBuffer
-
initialize
-
concat
Concatenates multipleTensorInt32instances into a singleTensorInt32.- Parameters:
arrays- Variable number ofTensorInt32objects to be concatenated.- Returns:
- A new
TensorInt32instance containing all the elements of the input arrays, concatenated in the order they were provided.
-
TensorInt32when preview features are enabled.