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.TensorFP32
TensorFP32 relies on preview features of the Java platform:
TensorFP32refers 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
ConstructorsConstructorDescriptionTensorFP32(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 TensorFP32concat(TensorFP32... arrays) Concatenates multipleTensorFP32instances into a singleTensorFP32.floatget(int index) Gets the float value stored at the specified index of theFloatArrayinstance.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(float value) static voidinitialize(TensorFP32 tensor, short value) voidset(int index, float value) float[]
-
Constructor Details
-
TensorFP32
The memory segment representing the tensor data in native memory.
-
-
Method Details
-
init
public void init(float value) -
set
public void set(int index, float value) -
get
public float get(int index) Gets the float value stored at the specified index of theFloatArrayinstance.- 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
-
toHeapArray
public float[] toHeapArray() -
getFloatBuffer
-
initialize
-
concat
Concatenates multipleTensorFP32instances into a singleTensorFP32.- Parameters:
arrays- Variable number ofTensorFP32objects to be concatenated.- Returns:
- A new
TensorFP32instance containing all the elements of the input arrays, concatenated in the order they were provided.
-
TensorFP32when preview features are enabled.