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.TensorByte
TensorByte relies on preview features of the Java platform:
TensorByterefers 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
ConstructorsConstructorDescriptionTensorByte(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 TensorByteconcat(TensorByte... arrays) Concatenates multipleTensorByteinstances into a singleTensorByte.byteget(int index) Gets the float value stored at the specified index of theByteArrayinstance.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(byte value) voidset(int index, byte value)
-
Constructor Details
-
TensorByte
The memory segment representing the tensor data in native memory.
-
-
Method Details
-
init
public void init(byte value) -
set
public void set(int index, byte value) -
get
public byte get(int index) Gets the float value stored at the specified index of theByteArrayinstance.- 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
-
concat
Concatenates multipleTensorByteinstances into a singleTensorByte.- Parameters:
arrays- Variable number ofTensorByteobjects to be concatenated.- Returns:
- A new
TensorByteinstance containing all the elements of the input arrays, concatenated in the order they were provided.
-
TensorBytewhen preview features are enabled.