public class NDArray extends NDArrayBase
handle, isView| Modifier and Type | Method and Description |
|---|---|
byte[] |
asByteArray()
Return a copied flat java array of current array (row-major).
|
char[] |
asCharArray()
Return a copied flat java array of current array (row-major).
|
double[] |
asDoubleArray()
Return a copied flat java array of current array (row-major).
|
float[] |
asFloatArray()
Return a copied flat java array of current array (row-major).
|
int[] |
asIntArray()
Return a copied flat java array of current array (row-major).
|
long[] |
asLongArray()
Return a copied flat java array of current array (row-major).
|
short[] |
asShortArray()
Return a copied flat java array of current array (row-major).
|
void |
copyFrom(byte[] sourceArray)
Copy from a native array.
|
void |
copyFrom(char[] sourceArray)
Copy from a native array.
|
void |
copyFrom(double[] sourceArray)
Copy from a native array.
|
void |
copyFrom(float[] sourceArray)
Copy from a native array.
|
void |
copyFrom(int[] sourceArray)
Copy from a native array.
|
void |
copyFrom(long[] sourceArray)
Copy from a native array.
|
void |
copyFrom(short[] sourceArray)
Copy from a native array.
|
void |
copyFromRaw(byte[] sourceArray)
Copy from a raw byte array.
|
TVMContext |
ctx()
Get the context of current array.
|
static NDArray |
empty(long[] shape)
Create an empty float32 array on cpu given shape.
|
static NDArray |
empty(long[] shape,
TVMContext ctx)
Create an empty float32 array given shape and device.
|
static NDArray |
empty(long[] shape,
TVMType dtype)
Create an empty array on cpu given shape and type.
|
static NDArray |
empty(long[] shape,
TVMType dtype,
TVMContext ctx)
Create an empty array given shape, type and device.
|
protected void |
finalize() |
byte[] |
internal()
Return a copied internal byte array of current array (row-major).
|
long[] |
shape()
Get shape of current NDArray.
|
long |
size()
Get total size of current NDArray.
|
asNDArray, copyTo, releaseprotected void finalize()
throws Throwable
finalize in class NDArrayBaseThrowablepublic void copyFrom(double[] sourceArray)
sourceArray - the source datapublic void copyFrom(float[] sourceArray)
sourceArray - the source datapublic void copyFrom(long[] sourceArray)
sourceArray - the source datapublic void copyFrom(int[] sourceArray)
sourceArray - the source datapublic void copyFrom(short[] sourceArray)
sourceArray - the source datapublic void copyFrom(byte[] sourceArray)
sourceArray - the source datapublic void copyFrom(char[] sourceArray)
sourceArray - the source datapublic void copyFromRaw(byte[] sourceArray)
sourceArray - the source datapublic long[] shape()
public long size()
public double[] asDoubleArray()
public float[] asFloatArray()
public long[] asLongArray()
public int[] asIntArray()
public short[] asShortArray()
public char[] asCharArray()
public byte[] asByteArray()
public byte[] internal()
public TVMContext ctx()
public static NDArray empty(long[] shape, TVMType dtype, TVMContext ctx)
shape - The shape of the array.dtype - The data type of the array.ctx - The context of the array.public static NDArray empty(long[] shape, TVMType dtype)
shape - The shape of the array.dtype - The data type of the array.public static NDArray empty(long[] shape)
shape - The shape of the array.public static NDArray empty(long[] shape, TVMContext ctx)
shape - The shape of the array.ctx - The context of the array.Copyright © 2021. All rights reserved.