public class Nd4j extends Object
Modifier and Type | Field and Description |
---|---|
static DataBuffer.AllocationMode |
alloc |
static Nd4jBackend |
backend |
static boolean |
compressDebug |
static String |
DISTRIBUTION |
protected static DataType |
dtype |
static String |
DTYPE
Deprecated.
Use
ND4JSystemProperties.DTYPE |
static double |
EPS_THRESHOLD |
protected static NDArrayFactory |
INSTANCE |
static String |
LOG_INIT_ENV_PROPERTY
Deprecated.
Use
ND4JSystemProperties.LOG_INITIALIZATION |
static String |
NATIVE_OPS |
static boolean |
preventUnpack |
protected static Properties |
props |
static RandomFactory |
randomFactory |
Constructor and Description |
---|
Nd4j() |
Modifier and Type | Method and Description |
---|---|
static INDArray |
accumulate(INDArray... arrays)
This method sums given arrays and stores them to a new array
|
static INDArray |
accumulate(INDArray target,
Collection<INDArray> arrays)
This method sums given arrays and stores them to a given target array
|
static INDArray |
accumulate(INDArray target,
INDArray[] arrays)
This method sums given arrays and stores them to a given target array
|
static boolean |
allowsSpecifyOrdering()
Backend specific:
Returns whether specifying the order
for the blas impl is allowed (cblas)
|
static INDArray |
append(INDArray arr,
int padAmount,
double val,
int axis)
Append the given array with the specified value size along a particular axis.
|
static INDArray |
appendBias(INDArray... vectors) |
static INDArray |
arange(double end)
Create a 1D array of evenly spaced values between 0 (inclusive) and
end (exclusive)
with a step size of 1
See arange(double, double, double) with begin = 0 and step size 1. |
static INDArray |
arange(double begin,
double end)
Create a 1D array of evenly spaced values between
begin (inclusive) and end (exclusive)
with a step size of 1
See arange(double, double, double) with step size 1. |
static INDArray |
arange(double begin,
double end,
double step)
Create a 1D array of evenly spaced values between
begin (inclusive) and end (exclusive)
with a step size. |
static INDArray |
argMax(INDArray arr,
int... dimension)
Get the maximum values for a dimension.
|
static INDArray |
argMin(INDArray arr,
int... dimension)
See
argMax(INDArray, int...) but return minimum values. |
static INDArray |
averageAndPropagate(Collection<INDArray> arrays)
This method averages input arrays, and returns averaged array.
|
static INDArray |
averageAndPropagate(INDArray[] arrays)
This method averages input arrays, and returns averaged array.
|
static INDArray |
averageAndPropagate(INDArray target,
Collection<INDArray> arrays)
This method averages input arrays, and returns averaged array.
|
static void |
checkShapeValues(long... shape)
Throws exception on negative shape values.
|
static INDArray |
choice(INDArray source,
INDArray probs,
INDArray target)
This method samples value from Source array to Target,the default random number generator.
|
static INDArray |
choice(INDArray source,
INDArray probs,
INDArray target,
Random rng)
This method samples value from Source array to Target, with probabilites provided in Probs argument
|
static INDArray |
choice(INDArray source,
INDArray probs,
int numSamples)
This method returns new INDArray instance, sampled from Source array with probabilities given in Probs
using the default random number generator.
|
static INDArray |
choice(INDArray source,
INDArray probs,
int numSamples,
Random rng)
This method returns new INDArray instance, sampled from Source array with probabilities given in Probs.
|
static void |
clearNans(INDArray arr)
Clear nans from an ndarray
|
static INDArray |
concat(int dimension,
INDArray... toConcat)
Concatneate ndarrays along a dimension
|
static org.bytedeco.javacpp.Pointer |
convertToNumpy(INDArray arr)
Converts an
INDArray to a numpy struct. |
static void |
copy(INDArray a,
INDArray b)
Copy a to b
|
static INDArray |
create(boolean[] data)
Create a vector based on a java boolean array.
|
static INDArray |
create(boolean[][] data)
Create 2D boolean array based on java 2d boolean array.
|
static INDArray |
create(boolean[][] data,
long... shape)
Create a boolean array with given shape based on java 2d boolean array.
|
static INDArray |
create(boolean[] data,
long[] shape,
DataType type)
|
static INDArray |
create(boolean[] data,
long[] shape,
long[] strides,
char order,
DataType type)
|
static INDArray |
create(byte[] data,
long[] shape,
DataType type)
|
static INDArray |
create(byte[] data,
long[] shape,
long[] strides,
char order,
DataType type)
|
static INDArray |
create(Collection<String> strings,
long... shape) |
static INDArray |
create(Collection<String> strings,
long[] shape,
char order) |
static INDArray |
create(DataBuffer buffer)
Create an array based on the data buffer.
|
static INDArray |
create(DataBuffer data,
int... shape)
Create an array based on the data buffer with given shape.
|
static INDArray |
create(DataBuffer data,
int[] shape,
int[] strides,
long offset)
Create an array based on the data buffer with given shape, stride and offset.
|
static INDArray |
create(DataBuffer data,
int[] newShape,
int[] newStride,
long offset,
char ordering)
|
static INDArray |
create(DataBuffer data,
int[] shape,
long offset)
|
static INDArray |
create(DataBuffer data,
long... shape)
|
static INDArray |
create(DataBuffer data,
long[] shape,
long[] strides,
long offset)
|
static INDArray |
create(DataBuffer data,
long[] newShape,
long[] newStride,
long offset,
char ordering)
|
static INDArray |
create(DataBuffer data,
long[] newShape,
long[] newStride,
long offset,
char ordering,
DataType dataType)
Create an array based on the data buffer with given shape, stride, offset and data type.
|
static INDArray |
create(DataBuffer data,
long[] newShape,
long[] newStride,
long offset,
long ews,
char ordering)
Create an array based on the data buffer with given shape, stride and offset.
|
static INDArray |
create(DataType type,
long... shape)
Create an array with specified shape and datatype.
|
static INDArray |
create(DataType dataType,
long[] shape,
char ordering)
Create an array with given data type shape and ordering.
|
static INDArray |
create(DataType dataType,
long[] shape,
long[] strides,
char ordering)
Create an array with given shape, stride and ordering.
|
static INDArray |
create(double[] data)
Create double array based on java double array.
|
static INDArray |
create(double[][] data)
Create 2D double array based on java 2d double array.
|
static INDArray |
create(double[][][] data)
Create a 3D double array based on the 3D java double array.
|
static INDArray |
create(double[][][][] data)
Create 4D double array based on 4D java double array.
|
static INDArray |
create(double[][] data,
char ordering)
Create a 2D double array based on a 2D java double array with given ordering.
|
static INDArray |
create(double[] data,
char order)
Creates a row vector with the data
|
static INDArray |
create(double[] data,
int... shape)
Create an array of the specified shape initialized with values from a java 1d array.
|
static INDArray |
create(double[] data,
int[] shape,
char ordering)
Create an array withgiven shape and ordering based on a java double array.
|
static INDArray |
create(double[] data,
int[] shape,
long offset,
char ordering)
Create an array.
|
static INDArray |
create(double[] data,
long... shape)
|
static INDArray |
create(double[] data,
long[] shape,
char ordering)
|
static INDArray |
create(double[] data,
long[] shape,
DataType type)
|
static INDArray |
create(double[] data,
long[] shape,
long[] strides,
char order,
DataType type)
|
static INDArray |
create(double[] data,
long[] shape,
long offset,
char ordering)
|
static INDArray |
create(float[] data)
Creates a row vector with the data
|
static INDArray |
create(float[][] data)
Create 2D float array based on java 2d float array.
|
static INDArray |
create(float[][][] data)
Create a 3D float array based on the 3D java float array.
|
static INDArray |
create(float[][][][] data)
Create 4D float array based on 4D java float array.
|
static INDArray |
create(float[][] data,
char ordering)
Create 2D float array based on java 2d float array and ordering.
|
static INDArray |
create(float[] data,
char order)
Creates a row vector with the data
|
static INDArray |
create(float[] data,
int... shape)
Create an ndrray with the specified shape
|
static INDArray |
create(float[] data,
int[] shape,
char ordering)
|
static INDArray |
create(float[] data,
int[] shape,
int[] stride,
long offset)
Create an array of the specified type, shape and stride initialized with values from a java 1d array using offset.
|
static INDArray |
create(float[] data,
long... shape)
|
static INDArray |
create(float[] data,
long[] shape,
char ordering)
|
static INDArray |
create(float[] data,
long[] shape,
DataType type)
|
static INDArray |
create(float[] data,
long[] shape,
long[] strides,
char order,
DataType type)
|
static INDArray |
create(int... shape)
Creates an ndarray with the specified shape
|
static INDArray |
create(int columns)
Creates a row vector with the specified number of columns
|
static INDArray |
create(int[][][] data)
create 3D int array based on 3D java int array.
|
static INDArray |
create(int[][][][] data)
Create 4D int array based on 4D java int array.
|
static INDArray |
create(int[] shape,
char ordering)
Creates an ndarray with the specified shape
|
static INDArray |
create(int[] shape,
DataType dataType)
Create an array of given shape and data type.
|
static INDArray |
create(int[] sliceShape,
double[]... arrays)
See
#create(int[], float[]...) |
static INDArray |
create(int[] sliceShape,
float[]... arrays)
Create an ndarray based on the given data
|
static INDArray |
create(int[] shape,
int[] stride)
Creates an ndarray with the specified shape
|
static INDArray |
create(int[] shape,
int[] stride,
char ordering)
Creates an ndarray with the specified shape
|
static INDArray |
create(int[] shape,
int[] stride,
long offset)
Creates an ndarray with the specified shape
|
static INDArray |
create(int[] data,
long[] shape,
DataType type)
Create an array of the specified type and shape initialized with values from a java 1d array.
|
static INDArray |
create(int[] data,
long[] shape,
long[] strides,
char order,
DataType type)
Create an array of the specified type, shape and stride initialized with values from a java 1d array.
|
static INDArray |
create(int columns,
char order)
Creates a row vector with the specified number of columns
|
static INDArray |
create(int rows,
int columns)
Creates an ndarray with the specified shape
|
static INDArray |
create(int rows,
int columns,
int[] stride)
Creates an ndarray with the specified shape
|
static INDArray |
create(int rows,
int columns,
int[] stride,
char ordering)
Create a 2D array with given rows, columns, stride and ordering.
|
static INDArray |
create(int rows,
int columns,
int[] stride,
long offset)
Creates an ndarray with the specified shape
|
static INDArray |
create(List<? extends Number> list)
Creates a row vector with the data
|
static INDArray |
create(List<INDArray> list,
int... shape)
Creates an array with the specified shape from a list of arrays.
|
static INDArray |
create(List<INDArray> list,
long... shape)
|
static INDArray |
create(long... shape)
Creates an ndarray with the specified shape
|
static INDArray |
create(long[][] data)
Create 2D long array based on java 2d long array.
|
static INDArray |
create(long[] shape,
char ordering)
Create an array with given shape and ordering.
|
static INDArray |
create(long[] shape,
long[] stride)
|
static INDArray |
create(long[] shape,
long[] stride,
char ordering)
|
static INDArray |
create(long[] data,
long[] shape,
DataType type)
|
static INDArray |
create(long[] data,
long[] shape,
long[] strides,
char order,
DataType type)
|
static INDArray |
create(long[] shape,
long[] stride,
long offset,
char ordering)
Creates an ndarray with the specified shape
|
static INDArray |
create(long rows,
long columns,
char ordering)
Creates an ndarray with the specified shape
|
static INDArray |
create(LongShapeDescriptor descriptor)
See
create(LongShapeDescriptor, boolean) with initialize set to true. |
static INDArray |
create(LongShapeDescriptor descriptor,
boolean initialize)
Create an ndarray based on the given description,
|
static INDArray |
create(short[] data,
long[] shape,
DataType type)
|
static INDArray |
create(short[] data,
long[] shape,
long[] strides,
char order,
DataType type)
|
static INDArray |
create(String... strings) |
static INDArray |
createArrayFromShapeBuffer(DataBuffer data,
DataBuffer shapeInfo)
Create array based in data buffer and shape info,
|
static INDArray |
createArrayFromShapeBuffer(DataBuffer data,
org.nd4j.linalg.primitives.Pair<DataBuffer,long[]> shapeInfo)
Create array based in data buffer and shape info,
|
static DataBuffer |
createBuffer(byte[] data,
int length)
Create a buffer based on the data opType
|
static DataBuffer |
createBuffer(byte[] data,
int length,
long offset)
Create a buffer based on the data opType
|
static DataBuffer |
createBuffer(ByteBuffer buffer,
DataType type,
int length)
Creates a buffer of the specified opType
and length with the given byte buffer.
|
static DataBuffer |
createBuffer(ByteBuffer buffer,
DataType type,
int length,
long offset)
Creates a buffer of the specified opType and length with the given byte buffer.
|
static DataBuffer |
createBuffer(DataBuffer underlyingBuffer,
long offset,
long length)
Create a view of a data buffer
Leverages the underlying storage of the buffer with a new view
|
static DataBuffer |
createBuffer(DataType dataType,
long length,
boolean initialize)
Create a data buffer based on datatype.
|
static DataBuffer |
createBuffer(DataType dataType,
long length,
boolean initialize,
MemoryWorkspace workspace)
Create a data buffer based on datatype, workspace.
|
static DataBuffer |
createBuffer(double[] data)
|
static DataBuffer |
createBuffer(double[] data,
long offset)
Create a buffer based on the data opType
|
static DataBuffer |
createBuffer(float[] data)
Create a buffer based on the data opType
|
static DataBuffer |
createBuffer(float[] data,
long offset)
Create a buffer based on the data opType
|
static DataBuffer |
createBuffer(int[] data)
Create a buffer equal of length prod(shape)
|
static DataBuffer |
createBuffer(int[] shape,
DataType type)
Create a buffer equal of length prod(shape)
|
static DataBuffer |
createBuffer(int[] shape,
DataType type,
long offset)
Create a buffer equal of length prod(shape)
|
static DataBuffer |
createBuffer(int length,
long offset)
Creates a buffer of the specified length based on the data opType
|
static DataBuffer |
createBuffer(long length)
Creates a buffer of the specified length based on the data opType
|
static DataBuffer |
createBuffer(long[] data)
Create a buffer equal of length prod(shape)
|
static DataBuffer |
createBuffer(long[] shape,
DataType type)
|
static DataBuffer |
createBuffer(long length,
boolean initialize)
See {@link #createBuffer(DataType dataType, long length, boolean initialize) with default datatype.
|
static DataBuffer |
createBuffer(org.bytedeco.javacpp.Pointer pointer,
DataType type,
long length,
org.bytedeco.javacpp.indexer.Indexer indexer)
Create a data buffer
based on a pointer
with the given opType and length
|
static DataBuffer |
createBuffer(org.bytedeco.javacpp.Pointer pointer,
long length,
DataType dataType)
Creates a buffer of the specified type and length with the given pointer.
|
static DataBuffer |
createBuffer(org.bytedeco.javacpp.Pointer pointer,
org.bytedeco.javacpp.Pointer devicePointer,
long length,
DataType dataType)
Creates a buffer of the specified type and length with the given pointer at the specified device.
|
static DataBuffer |
createBufferDetached(double[] data)
|
static DataBuffer |
createBufferDetached(float[] data)
Create a buffer based on underlying array.
|
static DataBuffer |
createBufferDetached(int[] data)
Create a buffer equal of length prod(shape).
|
static DataBuffer |
createBufferDetached(int[] shape,
DataType type)
Create a buffer equal of length prod(shape).
|
static DataBuffer |
createBufferDetached(long[] data)
Create a buffer equal of length prod(shape).
|
static DataBuffer |
createBufferDetached(long[] shape,
DataType type)
|
static INDArray |
createFromArray(boolean... array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Boolean[] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(boolean[][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Boolean[][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(boolean[][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Boolean[][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(boolean[][][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Boolean[][][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(byte... array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Byte[] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(byte[][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Byte[][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(byte[][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Byte[][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(byte[][][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Byte[][][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(double... array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Double[] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(double[][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Double[][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(double[][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Double[][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(double[][][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Double[][][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(float... array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Float[] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(float[][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Float[][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(float[][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Float[][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(float[][][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Float[][][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(int... array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(int[][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(int[][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(int[][][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Integer[] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Integer[][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Integer[][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Integer[][][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(long... array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Long[] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(long[][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Long[][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(long[][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Long[][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(long[][][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Long[][][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(short... array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Short[] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(short[][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Short[][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(short[][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Short[][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(short[][][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromArray(Short[][][][] array)
This method creates INDArray from provided jvm array
|
static INDArray |
createFromFlatArray(FlatArray array)
|
static INDArray |
createFromNpyFile(File file)
Create from a given Numpy .npy file.
|
static INDArray |
createFromNpyPointer(org.bytedeco.javacpp.Pointer pointer)
Create from an in memory numpy pointer
|
static Map<String,INDArray> |
createFromNpzFile(File file) |
static INDArray |
createNpyFromByteArray(byte[] input)
Create an
INDArray from the given numpy input.The numpy input follows the format: https://docs.scipy.org/doc/numpy-1.14.0/neps/npy-format.html |
static INDArray |
createNpyFromInputStream(InputStream is)
Create a numpy array based on the passed in input stream
|
static DataBuffer |
createTypedBuffer(boolean[] data,
DataType dataType)
|
static DataBuffer |
createTypedBuffer(byte[] data,
DataType dataType)
|
static DataBuffer |
createTypedBuffer(double[] data,
DataType dataType)
Create a buffer based on the data of the underlying java array with the specified type..
|
static DataBuffer |
createTypedBuffer(double[] data,
DataType dataType,
MemoryWorkspace workspace)
Create a buffer based on the data of the underlying java array, specified type and workspace
|
static DataBuffer |
createTypedBuffer(float[] data,
DataType dataType)
|
static DataBuffer |
createTypedBuffer(float[] data,
DataType dataType,
MemoryWorkspace workspace)
|
static DataBuffer |
createTypedBuffer(int[] data,
DataType dataType)
|
static DataBuffer |
createTypedBuffer(long[] data,
DataType dataType)
|
static DataBuffer |
createTypedBuffer(short[] data,
DataType dataType)
|
static DataBuffer |
createTypedBufferDetached(boolean[] data,
DataType dataType)
|
static DataBuffer |
createTypedBufferDetached(byte[] data,
DataType dataType)
|
static DataBuffer |
createTypedBufferDetached(double[] data,
DataType dataType)
Create am uninitialized buffer based on the data of the underlying java array and specified type.
|
static DataBuffer |
createTypedBufferDetached(float[] data,
DataType dataType)
|
static DataBuffer |
createTypedBufferDetached(int[] data,
DataType dataType)
|
static DataBuffer |
createTypedBufferDetached(long[] data,
DataType dataType)
|
static DataBuffer |
createTypedBufferDetached(short[] data,
DataType dataType)
|
static INDArray |
createUninitialized(DataType type,
long... shape) |
static INDArray |
createUninitialized(DataType type,
long[] shape,
char ordering)
Creates an *uninitialized* array with the specified data type, shape and ordering.
|
static INDArray |
createUninitialized(int... shape)
|
static INDArray |
createUninitialized(int length)
|
static INDArray |
createUninitialized(int[] shape,
char ordering)
Creates an *uninitialized* array with the specified shape and ordering.
NOTE: The underlying memory (DataBuffer) will not be initialized. |
static INDArray |
createUninitialized(long... shape)
Creates an *uninitialized* ndarray with the specified shape and default ordering.
NOTE: The underlying memory (DataBuffer) will not be initialized. |
static INDArray |
createUninitialized(long length)
This method creates an *uninitialized* ndarray of specified length and default ordering.
|
static INDArray |
createUninitialized(long[] shape,
char ordering)
Creates an *uninitialized* array with the specified shape and ordering.
|
static INDArray |
createUninitialized(long rows,
long columns)
This method returns uninitialized 2D array of rows x columns
PLEASE NOTE: memory of underlying array will be NOT initialized, and won't be set to 0.0
|
static INDArray |
createUninitializedDetached(DataType dataType,
char ordering,
long... shape)
Create an uninitialized ndArray.
|
static INDArray |
createUninitializedDetached(DataType dataType,
long... shape)
See
createUninitializedDetached(DataType, char, long...) with default ordering. |
static INDArray |
cumsum(INDArray compute)
See
INDArray.cumsum(int) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
cumsum(INDArray compute,
int dimension)
See
INDArray.cumsum(int) with Integer.MAX_VALUE for full array reduction. |
static DataType |
dataType()
Returns the data opType used for the runtime
|
static DataType |
defaultFloatingPointType() |
static INDArray |
diag(INDArray x)
Creates a new matrix where the values of the given vector are the diagonal values of
the matrix if a vector is passed in, if a matrix is returns the kth diagonal
in the matrix
|
static INDArray |
empty()
This method creates "empty" INDArray with datatype determined by
dataType() |
static INDArray |
empty(DataType type)
This method creates "empty" INDArray of the specified datatype
|
static void |
enableFallbackMode(boolean reallyEnable)
This method enables fallback to safe-mode for specific operations.
|
static INDArray[] |
exec(CustomOp op)
Execute the operation and return the result
|
static INDArray[] |
exec(CustomOp op,
OpContext context)
Execute the operation and return the result
|
static INDArray |
exec(Op op)
Execute the operation and return the result
|
static INDArray |
expandDims(INDArray input,
int dimension)
Expand the array dimensions.
|
static INDArray |
eye(long n)
Create the identity ndarray
|
static NDArrayFactory |
factory()
The factory used for creating ndarrays
|
static INDArray |
fromByteArray(byte[] arr)
Read an ndarray from a byte array
|
static INDArray |
gemm(INDArray a,
INDArray b,
boolean transposeA,
boolean transposeB)
matrix multiply: implements op(a)*op(b)
where op(x) means transpose x (or not) depending on
setting of arguments transposea and transposeb.
so gemm(a,b,false,false) == a.mmul(b), gemm(a,b,true,false) == a.transpose().mmul(b) etc. |
static INDArray |
gemm(INDArray a,
INDArray b,
INDArray c,
boolean transposeA,
boolean transposeB,
double alpha,
double beta)
Matrix multiply: Implements c = alpha*op(a)*op(b) + beta*c where op(X) means transpose X (or not)
depending on setting of arguments transposeA and transposeB.
Note that matrix c MUST be fortran order, have zero offset and have c.data().length == c.length(). |
static AffinityManager |
getAffinityManager() |
static Nd4jBackend |
getBackend()
Retrieve the Nd4J backend.
|
static BlasWrapper |
getBlasWrapper()
Retrieve the BLAS wrapper.
|
static BasicNDArrayCompressor |
getCompressor()
This method returns BasicNDArrayCompressor instance,
suitable for NDArray compression/decompression
at runtime
|
static ConstantHandler |
getConstantHandler() |
static ConvolutionInstance |
getConvolution()
Get the convolution singleton
|
static DataBufferFactory |
getDataBufferFactory()
Get the data buffer factory instance.
|
static DeallocatorService |
getDeallocatorService() |
static DistributionFactory |
getDistributions()
Get the primary distributions
factory
|
static OpExecutioner |
getExecutioner()
Get the operation executioner instance.
|
static MemoryManager |
getMemoryManager()
This method returns backend-specific MemoryManager implementation, for low-level memory management
|
static NDArrayFactory |
getNDArrayFactory() |
static Random |
getRandom()
Get the current random generator
|
static RandomFactory |
getRandomFactory()
Get the RandomFactory instance
|
static ShapeInfoProvider |
getShapeInfoProvider() |
static BlasWrapper |
getSparseBlasWrapper()
Retreive the sparse BLAS wrapper.
|
static SparseInfoProvider |
getSparseInfoProvider() |
static int[] |
getStrides(int... shape)
Get the strides based on the shape
and NDArrays.order()
|
static int[] |
getStrides(int[] shape,
char order)
Get the strides for the given order and shape
|
static long[] |
getStrides(long... shape)
Get the strides based on the shape
and NDArrays.order()
|
static long[] |
getStrides(long[] shape,
char order) |
static MemoryWorkspaceManager |
getWorkspaceManager()
This method returns WorkspaceManager implementation to be used within this JVM process
|
static INDArray |
hstack(Collection<INDArray> arrs)
Concatenates two matrices horizontally.
|
static INDArray |
hstack(INDArray... arrs)
Concatenates two matrices horizontally.
|
void |
initWithBackend(Nd4jBackend backend)
Initialize with the specific backend
|
static boolean |
isExperimentalMode() |
static boolean |
isFallbackModeEnabled()
This method checks, if fallback mode was enabled.
|
static boolean |
isPrecisionBoostAllowed() |
static INDArray |
linspace(DataType dataType,
double lower,
double step,
long num)
Generate a linearly spaced 1d vector of the specified datatype
|
static INDArray |
linspace(DataType dtype,
long lower,
long num,
long step)
Generate a linearly spaced vector
|
static INDArray |
linspace(double lower,
double upper,
long num,
DataType dataType)
Generate a linearly spaced 1d vector of the specified datatype
|
static INDArray |
linspace(long lower,
long upper,
long num)
Generate a linearly spaced vector with default data type
|
static INDArray |
linspace(long lower,
long upper,
long num,
DataType dtype)
Generate a linearly spaced vector
|
static INDArray |
matmul(INDArray a,
INDArray b)
Matrix multiplication/dot product
See
matmul(INDArray, INDArray, INDArray, boolean, boolean, boolean) |
static INDArray |
matmul(INDArray a,
INDArray b,
boolean transposeA,
boolean transposeB,
boolean transposeResult)
Matrix multiplication/dot product.
See matmul(INDArray, INDArray, INDArray, boolean, boolean, boolean) |
static INDArray |
matmul(INDArray a,
INDArray b,
INDArray result)
Matrix multiplication/dot product.
See matmul(INDArray, INDArray, INDArray, boolean, boolean, boolean) |
static INDArray |
matmul(INDArray a,
INDArray b,
INDArray result,
boolean transposeA,
boolean transposeB,
boolean transposeResult)
Matrix multiplication/dot product
Depending on inputs dimensionality output result might be different.
|
static INDArray |
max(INDArray compute)
See
INDArray.max(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
max(INDArray compute,
int dimension)
See
INDArray.max(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
mean(INDArray compute)
See
INDArray.mean(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
mean(INDArray compute,
int dimension)
See
INDArray.mean(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray[] |
meshgrid(INDArray x,
INDArray y)
Meshgrid op.
|
static INDArray |
min(INDArray compute)
See
INDArray.min(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
min(INDArray compute,
int dimension)
See
INDArray.min(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
norm1(INDArray compute)
See
INDArray.norm1(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
norm1(INDArray compute,
int dimension)
See
INDArray.norm1(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
norm2(INDArray compute)
See
INDArray.norm2(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
norm2(INDArray compute,
int dimension)
See
INDArray.norm2(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
normmax(INDArray compute)
See
INDArray.normmax(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
normmax(INDArray compute,
int dimension)
See
INDArray.normmax(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
ones(DataType dataType,
int rows,
int columns)
Create a 2D array with the given rows, columns and data type initialised with ones.
|
static INDArray |
ones(DataType dataType,
long... shape)
Creates an array with the specified datatype and shape, with values all set to 1
|
static INDArray |
ones(int... shape)
Create an ndarray of ones
|
static INDArray |
ones(int rows,
int columns)
Creates a row vector with the specified number of columns
|
static INDArray |
ones(long... shape)
See {@link #ones(int...
|
static INDArray |
onesLike(INDArray arr)
Ones like
|
static Character |
order()
Returns the ordering of the ndarrays
|
static INDArray |
pad(INDArray toPad,
INDArray padding)
See
pad(INDArray, INDArray, Pad.Mode, double) with zero padding (zeros for padValue). |
static INDArray |
pad(INDArray toPad,
INDArray padWidth,
Pad.Mode padMode,
double padValue)
Pad the given ndarray to the size along each dimension.
|
static INDArray |
pad(INDArray toPad,
int... padWidth)
|
static INDArray |
pad(INDArray toPad,
int[][] padWidth)
|
static INDArray |
pad(INDArray toPad,
int[][] padWidth,
Pad.Mode padMode,
double padValue)
See
#pad(INDArray, INDArray, Mode, double) . |
static INDArray |
pad(INDArray toPad,
int[] padWidth,
Pad.Mode padMode,
double padValue)
See
#pad(INDArray, INDArray, Mode, double) , uses padWidth for all dimensions. |
static INDArray |
pile(Collection<INDArray> arrays)
This method stacks vertically examples with the same shape, increasing result dimensionality.
|
static INDArray |
pile(INDArray... arrays)
This method stacks vertically examples with the same shape, increasing result dimensionality.
|
static INDArray |
prepend(INDArray arr,
int padAmount,
double val,
int axis)
|
static INDArray |
prod(INDArray compute)
See
INDArray.prod(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
prod(INDArray compute,
int dimension)
See
INDArray.prod(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
pullRows(INDArray source,
INDArray destination,
int sourceDimension,
int... indexes)
This method produces concatenated array, that consist from tensors, fetched from source array, against some
dimension and specified indexes.
|
static INDArray |
pullRows(INDArray source,
int sourceDimension,
int... indexes)
This method produces concatenated array, that consist from tensors, fetched from source array, against some dimension and specified indexes
|
static INDArray |
pullRows(INDArray source,
int sourceDimension,
int[] indexes,
char order)
This method produces concatenated array,
that consist from tensors,
fetched from source array,
against some dimension and specified indexes
|
static INDArray |
rand(char order,
int... shape)
Create a random ndarray with the given shape and array order
Values are sampled from a uniform distribution over (0, 1)
|
static INDArray |
rand(char order,
int rows,
int columns)
Create a random ndarray with the given shape and output order
Values are sampled from a uniform distribution over (0, 1)
|
static INDArray |
rand(DataType dataType,
char order,
int... shape)
Deprecated.
|
static INDArray |
rand(DataType dataType,
char order,
long... shape)
Create a random ndarray with the given shape, data type, and array order
Values are sampled from a uniform distribution over (0, 1)
|
static INDArray |
rand(DataType dataType,
int... shape)
Create a random ndarray with the given shape and data type
Values are sampled from a uniform distribution over (0, 1)
|
static INDArray |
rand(DataType dataType,
int[] shape,
char order)
Deprecated.
use {@link Nd4j#rand(org.nd4j.linalg.api.buffer.DataType, char, long...))
|
static INDArray |
rand(DataType dataType,
long... shape)
Create a random ndarray with values from a uniform distribution over (0, 1) with the given shape and data type
|
static INDArray |
rand(Distribution dist,
long... shape)
Create a random ndarray with the given shape using the given rng
|
static INDArray |
rand(double min,
double max,
Random rng,
long... shape)
Generates a random matrix between min and max
|
static INDArray |
rand(INDArray target)
Fill the given ndarray with random numbers drawn from a uniform distribution
|
static INDArray |
rand(INDArray target,
Distribution dist)
Fill the given ndarray with random numbers drawn from the given distribution
|
static INDArray |
rand(INDArray target,
double min,
double max,
Random rng)
Fill the given ndarray with random numbers drawn from a uniform distribution using the given RandomGenerator
|
static INDArray |
rand(INDArray target,
long seed)
Fill the given ndarray with random numbers drawn from a uniform distribution
|
static INDArray |
rand(INDArray target,
Random rng)
Fill the given ndarray with random numbers drawn from a uniform distribution using the given RandomGenerator
|
static INDArray |
rand(int... shape)
Create a random ndarray with values from a uniform distribution over (0, 1) with the given shape
|
static INDArray |
rand(int[] shape,
Distribution dist)
Deprecated.
|
static INDArray |
rand(int[] shape,
double min,
double max,
Random rng)
Deprecated.
|
static INDArray |
rand(int[] shape,
long seed)
Deprecated.
|
static INDArray |
rand(int[] shape,
Random rng)
Deprecated.
|
static INDArray |
rand(int rows,
int columns)
Create a random ndarray with values from a uniform distribution over (0, 1) with the given shape
|
static INDArray |
rand(int rows,
int columns,
double min,
double max,
Random rng)
Generates a random matrix between min and max
|
static INDArray |
rand(int rows,
int columns,
long seed)
Create a random ndarray with values from a uniform distribution over (0, 1) with the given shape
using the given seed
|
static INDArray |
rand(int rows,
int columns,
Random rng)
Create a random ndarray with the given shape using the given rng
|
static INDArray |
rand(long... shape)
See
rand(int[]) |
static INDArray |
rand(long[] shape,
Distribution dist)
Deprecated.
|
static INDArray |
rand(long[] shape,
double min,
double max,
Random rng)
Deprecated.
|
static INDArray |
rand(long seed,
long... shape)
Create a random ndarray with values from a uniform distribution over (0, 1) with the given shape
using given seed
|
static INDArray |
rand(Random rng,
long... shape)
Create a random ndarray with the given shape using the given RandomGenerator
|
static INDArray |
randn(char order,
int... shape)
Random normal N(0,1) with the specified shape and array order
|
static INDArray |
randn(char order,
long... shape)
Random normal N(0,1) with the specified shape and array order
|
static INDArray |
randn(char order,
long rows,
long columns)
Random normal N(0,1) with the specified shape and array order
|
static INDArray |
randn(DataType dataType,
char order,
long... shape)
Random normal N(0,1) with the specified shape and array order
|
static INDArray |
randn(DataType dataType,
int... shape)
Create a ndarray of the given shape and data type with values from N(0,1)
|
static INDArray |
randn(DataType dataType,
long... shape)
Create a ndarray of the given shape and data type with values from N(0,1)
|
static INDArray |
randn(INDArray target)
Fill the given ndarray with random numbers drawn from a normal distribution
|
static INDArray |
randn(INDArray target,
long seed)
Fill the given ndarray with random numbers drawn from a normal distribution
|
static INDArray |
randn(INDArray target,
Random rng)
Fill the given ndarray with random numbers drawn from a normal distribution utilizing the given random generator
|
static INDArray |
randn(int... shape)
Create a ndarray of the given shape with values from N(0,1)
|
static INDArray |
randn(int[] shape,
long seed)
Deprecated.
|
static INDArray |
randn(int[] shape,
Random r)
Deprecated.
|
static INDArray |
randn(long... shape)
Create a ndarray of the given shape with values from N(0,1).
|
static INDArray |
randn(long[] shape,
Random r)
Deprecated.
|
static INDArray |
randn(long seed,
long... shape)
Random normal N(0, 1) using the specified seed
|
static INDArray |
randn(long rows,
long columns)
Random normal N(0, 1)
|
static INDArray |
randn(long rows,
long columns,
long seed)
Random normal using the specified seed
|
static INDArray |
randn(long rows,
long columns,
Random r)
Random normal using the given rng
|
static INDArray |
randn(Random r,
long... shape)
Random normal using the given rng
|
static INDArray |
randomBernoulli(double p,
INDArray target)
Fill the specified array with values generated according to a binomial distribution with probability p: i.e.,
values 0 with probability (1-p) or value 1 with probability p
|
static INDArray |
randomBernoulli(double p,
long... shape)
Generate a random array according to a binomial distribution with probability p: i.e., values 0 with probability
(1-p) or value 1 with probability p
|
static INDArray |
randomBinomial(int nTrials,
double p,
INDArray target)
Fill the target array with random values generated according to a binomial distribution with the specified
number of trials and probability
|
static INDArray |
randomBinomial(int nTrials,
double p,
long... shape)
Generate an array with random values generated according to a binomial distribution with the specified
number of trials and probability
|
static INDArray |
randomExponential(double lambda,
INDArray target)
Exponential distribution: P(x) = lambda * exp(-lambda * x)
|
static INDArray |
randomExponential(double lambda,
long... shape)
Exponential distribution: P(x) = lambda * exp(-lambda * x)
|
static INDArray |
read(DataInputStream dis)
Read in an ndarray from a data input stream
|
static INDArray |
read(InputStream reader)
Raad an ndarray from an input stream
See
read(DataInputStream) |
static INDArray |
readBinary(File read)
Read a binary ndarray from the given file
|
static INDArray |
readNumpy(DataType dataType,
InputStream filePath,
String split,
Charset charset)
Read array from input stream.
|
static INDArray |
readNumpy(DataType dataType,
String filePath)
Read array.
See readNumpy(DataType, InputStream, String , Charset) with default split and UTF-8 encoding. |
static INDArray |
readNumpy(DataType dataType,
String filePath,
String split)
Read array via input stream.
|
static INDArray |
readNumpy(InputStream filePath,
String split)
Read line via input streams
|
static INDArray |
readNumpy(String filePath)
Read line via input streams
|
static INDArray |
readNumpy(String filePath,
String split)
Read line via input streams
|
static INDArray |
readTxt(String filePath)
Read line via input streams
|
static INDArray |
readTxtString(InputStream ndarray)
Read line via input streams
|
static INDArray |
repeat(INDArray n,
int num)
Create an n x (shape)
ndarray where the ndarray is repeated num times
|
static INDArray |
reverse(INDArray reverse)
Reverses the passed in matrix such that m[0] becomes m[m.length - 1] etc
|
static INDArray |
rollAxis(INDArray a,
int axis)
Roll the specified axis backwards,
until it lies in a given position.
|
static INDArray |
rollAxis(INDArray a,
int axis,
int start)
Roll the specified axis backwards,
until it lies in a given position.
|
static void |
rot90(INDArray toRotate)
Rotate a matrix 90 degrees
|
static void |
saveBinary(INDArray arr,
File saveTo)
Save an ndarray to the given file
|
static INDArray |
scalar(boolean value)
Create a scalar NDArray with the specified value and BOOLEAN datatype
|
static INDArray |
scalar(DataType dataType,
Number value)
Create a scalar ndarray with the specified value and datatype
|
static INDArray |
scalar(double value)
Create a scalar nd array with the specified value
|
static INDArray |
scalar(float value)
Create a scalar NDArray with the specified value and FLOAT datatype
|
static INDArray |
scalar(int value)
Create a scalar NDArray with the specified value and INT datatype
|
static INDArray |
scalar(long value)
Create a scalar NDArray with the specified value and LONG datatype
|
static INDArray |
scalar(Number value)
Create a scalar ndarray with the specified value
|
static INDArray |
scalar(String string) |
static void |
scatterUpdate(ScatterUpdate.UpdateOp op,
INDArray array,
INDArray indices,
INDArray updates,
int... axis)
Deprecated.
|
static void |
setConvolution(ConvolutionInstance convolutionInstance)
Set a convolution instance
|
static void |
setDataType(DataType dtype)
Deprecated.
use
setDefaultDataTypes(DataType, DataType) . Equivalent to setDefaultDataTypes(dtype, (dtype.isFPType() ? dtype : defaultFloatingPointType())) |
static void |
setDefaultDataTypes(DataType defaultType,
DataType defaultFloatingPointType)
Set the default data types.
The default data types are used for array creation methods where no data type is specified. When the user explicitly provides a datatype (such as in Nd4j.ones(DataType.FLOAT, 1, 10)) these default values will not be used. defaultType: used in methods such as Nd4j.ones(1,10) and Nd4j.zeros(10). defaultFloatingPointType: used internally where a floating point array needs to be created, but no datatype is specified. |
static void |
setFactory(NDArrayFactory factory)
Set the factory instance for INDArray creation.
|
static long[] |
shape(INDArray arr)
Returns the shape of the ndarray
|
static void |
shuffle(Collection<INDArray> toShuffle,
int... dimension)
Symmetric in place shuffle of an ndarray
along a specified set of dimensions
|
static void |
shuffle(Collection<INDArray> toShuffle,
Random rnd,
int... dimension)
Symmetric in place shuffle of an ndarray
along a specified set of dimensions
|
static void |
shuffle(INDArray toShuffle,
int... dimension)
In place shuffle of an ndarray
along a specified set of dimensions
|
static void |
shuffle(INDArray toShuffle,
Random random,
int... dimension)
In place shuffle of an ndarray
along a specified set of dimensions
|
static void |
shuffle(List<INDArray> toShuffle,
Random rnd,
List<int[]> dimensions)
Symmetric in place shuffle of an ndarray
along a variable dimensions
|
static int |
sizeOfDataType()
Deprecated.
Use DataType.width()
|
static int |
sizeOfDataType(DataType dtype)
This method returns size of element for specified dataType, in bytes
|
static INDArray |
sort(INDArray ndarray,
boolean ascending)
Sort all elements of an array.
|
static INDArray |
sort(INDArray ndarray,
int dimension,
boolean ascending)
Sort an ndarray along a particular dimension
Note that the input array is modified in-place. |
static INDArray |
sortColumns(INDArray in,
int rowIdx,
boolean ascending)
Sort (shuffle) the columns of a 2d array according to the value at a specified row.
|
static INDArray |
sortRows(INDArray in,
int colIdx,
boolean ascending)
Sort (shuffle) the rows of a 2d array according to the value at a specified column.
|
static INDArray[] |
sortWithIndices(INDArray ndarray,
int dimension,
boolean ascending)
Sort an ndarray along a particular dimension.
Note that the input array is modified in-place. |
static NDArrayFactory |
sparseFactory()
The factory used for creating sparse arrays.
|
static INDArray |
specialConcat(int dimension,
INDArray... toConcat)
Concatneate ndarrays along a dimension
PLEASE NOTE: This method is special for GPU backend, it works on HOST side only.
|
static INDArray |
squeeze(INDArray input,
int dimension)
Squeeze : removes a dimension of size 1
|
static INDArray |
stack(int axis,
INDArray... values)
Stack a set of N SDVariables of rank X into one rank X+1 variable.
|
static INDArray |
std(INDArray compute)
See
INDArray.std(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
std(INDArray compute,
int dimension)
See
INDArray.std(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
stripOnes(INDArray toStrip)
Reshapes an ndarray to remove leading 1s
|
static INDArray |
sum(INDArray compute)
See
INDArray.sum(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
sum(INDArray compute,
int dimension)
See
INDArray.sum(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray[] |
tear(INDArray tensor,
int... dimensions)
This method does the opposite to pile/vstack/hstack - it returns independent TAD copies along given dimensions
|
static INDArray |
tensorMmul(INDArray a,
INDArray b,
INDArray result,
int[][] axes)
Tensor matrix multiplication.
|
static INDArray |
tensorMmul(INDArray a,
INDArray b,
int[][] axes)
Tensor matrix multiplication.
|
static INDArray |
tile(INDArray tile,
int... repeat)
An alias for repmat
|
static byte[] |
toByteArray(INDArray arr)
Convert an ndarray to a byte array
|
static INDArray |
toFlattened(char order,
Collection<INDArray> matrices)
Create a long row vector of all of the given ndarrays
|
static INDArray |
toFlattened(char order,
INDArray... matrices)
Create a long row vector of all of the given ndarrays/
|
static INDArray |
toFlattened(Collection<INDArray> matrices)
Create a long row vector of all of the given ndarrays
|
static INDArray |
toFlattened(INDArray... matrices)
Create a long row vector of all of the given ndarrays
|
static byte[] |
toNpyByteArray(INDArray input)
Converts an
INDArray to a byte array |
static INDArray |
tri(int n)
See
tri(int,int,int) with m = n, k=0. |
static INDArray |
tri(int n,
int k)
See
tri(int,int,int) with m = n. |
static INDArray |
tri(int n,
int m,
int k)
Like the scipy function tri.
|
static INDArray |
triu(INDArray m,
int k)
Upper triangle of an array.
|
static INDArray |
valueArrayOf(int[] shape,
double value)
Creates an ndarray with the specified value
as the only value in the ndarray.
|
static INDArray |
valueArrayOf(long[] shape,
double value)
|
static INDArray |
valueArrayOf(long[] shape,
double value,
DataType type)
Creates an ndarray with the specified value
as the only value in the ndarray.
|
static INDArray |
valueArrayOf(long[] shape,
float value)
Creates an ndarray with the specified value as the only value in the FLOAT32 datatype NDArray.
|
static INDArray |
valueArrayOf(long[] shape,
int value)
Creates an ndarray with the specified value as the only value in the INTEGER datatype NDArray.
|
static INDArray |
valueArrayOf(long[] shape,
long value,
DataType type)
|
static INDArray |
valueArrayOf(long num,
double value)
Creates a row vector ndarray with the specified value
as the only value in the ndarray
Some people may know this as np.full
|
static INDArray |
valueArrayOf(long rows,
long columns,
double value)
Creates a row vector with the specified number of columns
Some people may know this as np.full
|
static INDArray |
var(INDArray compute)
See
INDArray.var(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
var(INDArray compute,
int dimension)
See
INDArray.var(int...) with Integer.MAX_VALUE for full array reduction. |
static INDArray |
vstack(Collection<INDArray> arrs)
Concatenates two matrices vertically.
|
static INDArray |
vstack(INDArray... arrs)
Concatenates two matrices vertically.
|
static INDArray[] |
where(INDArray condition,
INDArray x,
INDArray y)
Similar to numpy.where operation.
|
static void |
write(INDArray arr,
DataOutputStream dataOutputStream)
Write an ndarray to the specified outputstream
|
static void |
write(OutputStream writer,
INDArray write)
Y
Write an ndarray to a writer
|
static void |
writeAsNumpy(INDArray arr,
File file)
|
static void |
writeAsNumpy(INDArray arr,
OutputStream writeTo)
Writes an array to an output stream
|
static void |
writeTxt(INDArray write,
String filePath)
Write NDArray to a text file
|
static void |
writeTxt(INDArray write,
String filePath,
int precision)
Deprecated.
Defaults to scientific notation with 18 digits after the decimal
Use
writeTxt(INDArray, String) |
static void |
writeTxt(INDArray write,
String filePath,
String split)
Deprecated.
custom col and higher dimension separators are no longer supported; uses ","
Use
writeTxt(INDArray, String) |
static void |
writeTxt(INDArray write,
String filePath,
String split,
int precision)
Deprecated.
Precision is no longer used. Split is no longer used.
Defaults to scientific notation with 18 digits after the decimal
Use
writeTxt(INDArray, String) |
static INDArray |
zeros(DataType dataType,
int columns)
Creates a 1D array with the specified data tyoe and number of columns initialized with zero.
|
static INDArray |
zeros(DataType dataType,
long... shape)
Creates an array with the specified data tyoe and shape initialized with zero.
|
static INDArray |
zeros(int... shape)
Create an ndarray of zeros
|
static INDArray |
zeros(int columns)
Creates a 1D array with the specified number of columns initialized with zero.
|
static INDArray |
zeros(int[] shape,
char order)
Create an ndarray of zeros
|
static INDArray |
zeros(int[] shape,
DataType dataType) |
static INDArray |
zeros(int[] shape,
int[] stride)
|
static INDArray |
zeros(int[] shape,
int[] stride,
long offset)
|
static INDArray |
zeros(int columns,
char order)
Create a 1D float array in soecified order initialized with zero.
|
static INDArray |
zeros(int rows,
int columns,
char ordering)
Create a 2D array initialized with zeros.
|
static INDArray |
zeros(int rows,
int columns,
int[] stride)
See
#create(int, int, int[], char) |
static INDArray |
zeros(int rows,
int columns,
int[] stride,
long offset)
|
static INDArray |
zeros(long... shape)
Create an ndarray of zeros
|
static INDArray |
zeros(long[] shape,
char order)
|
static INDArray |
zeros(long rows,
long columns)
Creates a 2D array with specified number of rows, columns initialized with zero.
|
static INDArray |
zerosLike(INDArray arr)
Empty like
|
@Deprecated public static final String DTYPE
ND4JSystemProperties.DTYPE
public static final String NATIVE_OPS
public static final String DISTRIBUTION
@Deprecated public static final String LOG_INIT_ENV_PROPERTY
ND4JSystemProperties.LOG_INITIALIZATION
protected static DataType dtype
public static DataBuffer.AllocationMode alloc
public static double EPS_THRESHOLD
public static boolean compressDebug
public static volatile boolean preventUnpack
public static Nd4jBackend backend
public static RandomFactory randomFactory
protected static NDArrayFactory INSTANCE
protected static Properties props
public static INDArray pad(@NonNull INDArray toPad, @NonNull int[][] padWidth)
pad(INDArray, INDArray)
. Uses 0 padding.public static INDArray pad(@NonNull INDArray toPad, @NonNull int... padWidth)
pad(INDArray, INDArray)
. Uses 0 padding, and uses padWidth for all dimensions.public static INDArray pad(INDArray toPad, INDArray padding)
pad(INDArray, INDArray, Pad.Mode, double)
with zero padding (zeros for padValue).public static INDArray pad(@NonNull INDArray toPad, @NonNull int[][] padWidth, @NonNull Pad.Mode padMode, double padValue)
#pad(INDArray, INDArray, Mode, double)
.public static INDArray pad(@NonNull INDArray toPad, @NonNull int[] padWidth, @NonNull Pad.Mode padMode, double padValue)
#pad(INDArray, INDArray, Mode, double)
, uses padWidth for all dimensions.public static INDArray pad(@NonNull INDArray toPad, @NonNull INDArray padWidth, @NonNull Pad.Mode padMode, double padValue)
toPad
- the ndarray to padpadWidth
- the width to pad along each dimensionpadMode
- the mode to pad inpadValue
- the value used during padding. Only used when padMode is Pad.Mode#CONSTANT
.public static INDArray append(INDArray arr, int padAmount, double val, int axis)
arr
- the array to append topadAmount
- the pad amount of the array to be returnedval
- the value to appendaxis
- the axis to append topublic static INDArray prepend(INDArray arr, int padAmount, double val, int axis)
append(INDArray, int, double, int)
. This function calls the implementation with appendFlag = false
to prepend.public static INDArray expandDims(INDArray input, int dimension)
input
- the input arraydimension
- the dimension to add the
new axis atpublic static INDArray squeeze(INDArray input, int dimension)
input
- the input arraydimension
- the dimension to removepublic static boolean allowsSpecifyOrdering()
public static void shuffle(INDArray toShuffle, Random random, @NonNull int... dimension)
toShuffle
- the ndarray to shufflerandom
- the random to usedimension
- the dimension to do the shufflepublic static void shuffle(INDArray toShuffle, @NonNull int... dimension)
toShuffle
- the ndarray to shuffledimension
- the dimension to do the shufflepublic static void shuffle(Collection<INDArray> toShuffle, @NonNull int... dimension)
toShuffle
- the ndarray to shuffledimension
- the dimension to do the shufflepublic static void shuffle(Collection<INDArray> toShuffle, Random rnd, @NonNull int... dimension)
toShuffle
- the ndarray to shuffledimension
- the dimension to do the shufflepublic static void shuffle(List<INDArray> toShuffle, Random rnd, List<int[]> dimensions)
toShuffle
- the ndarray to shuffledimensions
- the dimension to do the shuffle. Please note - order matters here.public static DistributionFactory getDistributions()
public static Random getRandom()
public static RandomFactory getRandomFactory()
public static ConvolutionInstance getConvolution()
public static void setConvolution(ConvolutionInstance convolutionInstance)
convolutionInstance
- the new convolution instancepublic static long[] shape(INDArray arr)
arr
- the array to get the shape ofpublic static INDArray create(int[] sliceShape, float[]... arrays)
sliceShape
- the shape of each slicearrays
- the arrays of data to createpublic static INDArray create(LongShapeDescriptor descriptor)
create(LongShapeDescriptor, boolean)
with initialize set to true.public static INDArray create(LongShapeDescriptor descriptor, boolean initialize)
descriptor
- object with data for array creation.initialize
- true/false creates initialized/uninitialized array.public static INDArray create(int[] sliceShape, double[]... arrays)
#create(int[], float[]...)
public static OpExecutioner getExecutioner()
public static DataBufferFactory getDataBufferFactory()
public static INDArray rollAxis(INDArray a, int axis)
a
- the array to rollaxis
- the axis to roll backwardspublic static INDArray argMax(INDArray arr, @NonNull int... dimension)
arr
- input array.dimension
- the dimension along which to get the maximumpublic static INDArray argMin(INDArray arr, @NonNull int... dimension)
argMax(INDArray, int...)
but return minimum values.public static INDArray rollAxis(INDArray a, int axis, int start)
a
- the array to rollaxis
- the axis to roll backwardsstart
- the starting pointpublic static INDArray tensorMmul(INDArray a, INDArray b, INDArray result, int[][] axes)
a
- the left tensorb
- the right tensorresult
- the result arrayaxes
- the axes for each array to do matrix multiply alongpublic static INDArray tensorMmul(INDArray a, INDArray b, int[][] axes)
a
- the left tensorb
- the right tensoraxes
- the axes for each array to do matrix multiply alongpublic static INDArray gemm(INDArray a, INDArray b, boolean transposeA, boolean transposeB)
a
- first matrixb
- second matrixtransposeA
- if true: transpose matrix a before mmultransposeB
- if true: transpose matrix b before mmulpublic static INDArray gemm(INDArray a, INDArray b, INDArray c, boolean transposeA, boolean transposeB, double alpha, double beta)
a
- First matrixb
- Second matrixc
- result matrix. Used in calculation (assuming beta != 0) and result is stored in this. f order, and not a view onlytransposeA
- if true: transpose matrix a before mmultransposeB
- if true: transpose matrix b before mmulpublic static INDArray matmul(INDArray a, INDArray b, INDArray result, boolean transposeA, boolean transposeB, boolean transposeResult)
a
- First tensorb
- Second tensorresult
- result matrix.transposeA
- if true: transpose matrix a before mmultransposeB
- if true: transpose matrix b before mmultransposeResult
- if true: result matrix will be transposedpublic static INDArray matmul(INDArray a, INDArray b, INDArray result)
matmul(INDArray, INDArray, INDArray, boolean, boolean, boolean)
public static INDArray matmul(INDArray a, INDArray b, boolean transposeA, boolean transposeB, boolean transposeResult)
matmul(INDArray, INDArray, INDArray, boolean, boolean, boolean)
public static INDArray matmul(INDArray a, INDArray b)
matmul(INDArray, INDArray, INDArray, boolean, boolean, boolean)
public static NDArrayFactory factory()
public static NDArrayFactory sparseFactory()
public static INDArray cumsum(INDArray compute)
INDArray.cumsum(int)
with Integer.MAX_VALUE for full array reduction.public static INDArray max(INDArray compute)
INDArray.max(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray min(INDArray compute)
INDArray.min(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray prod(INDArray compute)
INDArray.prod(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray normmax(INDArray compute)
INDArray.normmax(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray norm2(INDArray compute)
INDArray.norm2(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray norm1(INDArray compute)
INDArray.norm1(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray std(INDArray compute)
INDArray.std(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray var(INDArray compute)
INDArray.var(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray sum(INDArray compute)
INDArray.sum(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray mean(INDArray compute)
INDArray.mean(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray cumsum(INDArray compute, int dimension)
INDArray.cumsum(int)
with Integer.MAX_VALUE for full array reduction.public static INDArray max(INDArray compute, int dimension)
INDArray.max(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray min(INDArray compute, int dimension)
INDArray.min(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray prod(INDArray compute, int dimension)
INDArray.prod(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray normmax(INDArray compute, int dimension)
INDArray.normmax(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray norm2(INDArray compute, int dimension)
INDArray.norm2(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray norm1(INDArray compute, int dimension)
INDArray.norm1(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray std(INDArray compute, int dimension)
INDArray.std(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray var(INDArray compute, int dimension)
INDArray.var(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray sum(INDArray compute, int dimension)
INDArray.sum(int...)
with Integer.MAX_VALUE for full array reduction.public static INDArray mean(INDArray compute, int dimension)
INDArray.mean(int...)
with Integer.MAX_VALUE for full array reduction.public static DataBuffer createBuffer(DataBuffer underlyingBuffer, long offset, long length)
underlyingBuffer
- the underlying bufferoffset
- the offset for the viewpublic static DataBuffer createBuffer(int[] shape, DataType type, long offset)
shape
- the shape of the buffer to createtype
- the opType to createpublic static DataBuffer createBuffer(ByteBuffer buffer, DataType type, int length, long offset)
buffer
- the buffer to create fromtype
- the opType of buffer to createlength
- the length of the bufferpublic static DataBuffer createBuffer(byte[] data, int length, long offset)
data
- the data to create the buffer withpublic static DataBuffer createBuffer(int length, long offset)
length
- the length of te bufferpublic static DataBuffer createBuffer(@NonNull org.bytedeco.javacpp.Pointer pointer, long length, @NonNull DataType dataType)
pointer
- pointer to data to create from.length
- the length of the bufferdataType
- the opType of buffer to create,public static DataBuffer createBuffer(@NonNull org.bytedeco.javacpp.Pointer pointer, @NonNull org.bytedeco.javacpp.Pointer devicePointer, long length, @NonNull DataType dataType)
pointer
- pointer to data to create from.devicePointer
- pointer to device to create in (only implemented in the CUDA backend)length
- the length of the bufferdataType
- the opType of buffer to create,public static DataBuffer createBuffer(float[] data, long offset)
data
- the data to create the buffer withpublic static DataBuffer createBuffer(double[] data, long offset)
data
- the data to create the buffer withpublic static DataBuffer createBuffer(int[] shape, DataType type)
shape
- the shape of the buffer to createtype
- the opType to createpublic static DataBuffer createBuffer(long[] shape, DataType type)
public static DataBuffer createBufferDetached(int[] shape, DataType type)
shape
- the shape of the buffer to createtype
- the opType to createpublic static DataBuffer createBufferDetached(long[] shape, DataType type)
public static DataBuffer createBuffer(ByteBuffer buffer, DataType type, int length)
buffer
- the buffer to create fromtype
- the opType of buffer to createlength
- the length of the bufferpublic static DataBuffer createBuffer(byte[] data, int length)
data
- the data to create the buffer withpublic static DataBuffer createBuffer(int[] data)
data
- the shape of the buffer to createpublic static DataBuffer createBuffer(long[] data)
data
- the shape of the buffer to createpublic static DataBuffer createBufferDetached(int[] data)
data
- the shape of the buffer to createpublic static DataBuffer createBufferDetached(long[] data)
data
- the shape of the buffer to createpublic static DataBuffer createBuffer(long length)
length
- the length of te bufferpublic static DataBuffer createBuffer(org.bytedeco.javacpp.Pointer pointer, DataType type, long length, org.bytedeco.javacpp.indexer.Indexer indexer)
pointer
- the pointer to create the buffer fortype
- the opType of pointerlength
- the length of the bufferindexer
- the indexer to usepublic static DataBuffer createBuffer(long length, boolean initialize)
public static DataBuffer createBuffer(DataType dataType, long length, boolean initialize)
dataType
- the type of buffer to createlength
- the length of the bufferinitialize
- flag to leave the underlying memory (false) or initialize with zero (true).public static DataBuffer createBuffer(DataType dataType, long length, boolean initialize, MemoryWorkspace workspace)
dataType
- the type of buffer to createlength
- the length of the bufferinitialize
- flag to leave the underlying memory (false) or initialize with zero (true).workspace
- workspace to use for buffer creation.public static DataBuffer createBuffer(float[] data)
data
- the data to create the buffer withpublic static DataBuffer createBufferDetached(float[] data)
data
- data to create the buffer withpublic static DataBuffer createBufferDetached(double[] data)
public static DataBuffer createBuffer(double[] data)
public static DataBuffer createTypedBuffer(double[] data, DataType dataType)
data
- underlying java arraydataType
- specified type.public static DataBuffer createTypedBuffer(float[] data, DataType dataType)
public static DataBuffer createTypedBuffer(int[] data, DataType dataType)
public static DataBuffer createTypedBuffer(long[] data, DataType dataType)
public static DataBuffer createTypedBuffer(short[] data, DataType dataType)
public static DataBuffer createTypedBuffer(byte[] data, DataType dataType)
public static DataBuffer createTypedBuffer(boolean[] data, DataType dataType)
public static DataBuffer createTypedBuffer(double[] data, DataType dataType, MemoryWorkspace workspace)
data
- underlying java arraydataType
- specified type.workspace
- specified workspace.public static DataBuffer createTypedBuffer(float[] data, DataType dataType, MemoryWorkspace workspace)
public static DataBuffer createTypedBufferDetached(double[] data, DataType dataType)
data
- underlying java arraydataType
- specified type.public static DataBuffer createTypedBufferDetached(float[] data, DataType dataType)
public static DataBuffer createTypedBufferDetached(int[] data, DataType dataType)
public static DataBuffer createTypedBufferDetached(long[] data, DataType dataType)
public static DataBuffer createTypedBufferDetached(short[] data, DataType dataType)
public static DataBuffer createTypedBufferDetached(byte[] data, DataType dataType)
public static DataBuffer createTypedBufferDetached(boolean[] data, DataType dataType)
public static void setFactory(NDArrayFactory factory)
factory
- new INDArray factorypublic static Character order()
public static DataType dataType()
@Deprecated public static void setDataType(@NonNull DataType dtype)
setDefaultDataTypes(DataType, DataType)
. Equivalent to setDefaultDataTypes(dtype, (dtype.isFPType() ? dtype : defaultFloatingPointType()))
setDefaultDataTypes(DataType, DataType)
This method sets dataType for the current JVM.dtype
- Data type to setpublic static void setDefaultDataTypes(@NonNull DataType defaultType, @NonNull DataType defaultFloatingPointType)
defaultType
- Default datatype for new arrays (used when no type is specified).defaultFloatingPointType
- Default datatype for new floating point arrays (used when no type is specified. Must be one of DOUBLE, FLOAT or HALFpublic static Nd4jBackend getBackend()
public static BlasWrapper getBlasWrapper()
public static BlasWrapper getSparseBlasWrapper()
public static INDArray[] sortWithIndices(INDArray ndarray, int dimension, boolean ascending)
ndarray
- the ndarray to sortdimension
- the dimension to sortpublic static INDArray sort(INDArray ndarray, boolean ascending)
ndarray
- array to sortascending
- true for ascending, false for descendingpublic static INDArray sort(INDArray ndarray, int dimension, boolean ascending)
ndarray
- the ndarray to sortdimension
- the dimension to sortpublic static INDArray sortRows(INDArray in, int colIdx, boolean ascending)
in
- 2d array to sortcolIdx
- The column to sort onascending
- true if smallest-to-largest; false if largest-to-smallestpublic static INDArray sortColumns(INDArray in, int rowIdx, boolean ascending)
in
- 2d array to sortrowIdx
- The row to sort onascending
- true if smallest-to-largest; false if largest-to-smallestpublic static INDArray repeat(INDArray n, int num)
n
- the ndarray to replicatenum
- the number of copies to repeatpublic static INDArray linspace(@NonNull DataType dtype, long lower, long num, long step)
lower
- upper boundnum
- number of items in returned vectorstep
- the step (incompatible with upper)public static INDArray linspace(long lower, long upper, long num)
lower
- lower boundupper
- upper boundnum
- number of items in returned vectorpublic static INDArray linspace(long lower, long upper, long num, @NonNull DataType dtype)
lower
- lower boundupper
- upper boundnum
- number of items in returned vectorpublic static INDArray linspace(@NonNull DataType dataType, double lower, double step, long num)
lower
- lower boundstep
- step between itemsnum
- number of resulting itemspublic static INDArray linspace(double lower, double upper, long num, @NonNull DataType dataType)
lower
- lower boundupper
- upper boundnum
- number of resulting itemspublic static INDArray[] meshgrid(@NonNull INDArray x, @NonNull INDArray y)
x
- X array inputy
- Y array inputpublic static INDArray toFlattened(Collection<INDArray> matrices)
matrices
- the matrices to create the flattened ndarray forpublic static INDArray toFlattened(char order, Collection<INDArray> matrices)
order
- the order in which to flatten the matricesmatrices
- the matrices to create the flattened ndarray forpublic static INDArray toFlattened(@NonNull INDArray... matrices)
matrices
- the matrices to create the flattened ndarray forpublic static INDArray toFlattened(char order, @NonNull INDArray... matrices)
order
- order in which to flatten ndarraysmatrices
- the matrices to create the flattened ndarray forpublic static INDArray eye(long n)
n
- the number for the identitypublic static void rot90(INDArray toRotate)
toRotate
- the matrix to rotatepublic static void writeTxt(INDArray write, String filePath, String split, int precision)
writeTxt(INDArray, String)
filePath
- path to write tosplit
- the split separator, defaults to ","precision
- digits after the decimal pointpublic static void writeTxt(INDArray write, String filePath, int precision)
writeTxt(INDArray, String)
write
- array to writefilePath
- path to write toprecision
- Precision is no longer used.public static void writeTxt(INDArray write, String filePath, String split)
writeTxt(INDArray, String)
write
- array to writefilePath
- path to write tosplit
- the split separator, defaults to ","public static void writeTxt(INDArray write, String filePath)
write
- Array to writefilePath
- path to write topublic static void write(OutputStream writer, INDArray write) throws IOException
writer
- the writer to write towrite
- the ndarray to writeIOException
public static byte[] toByteArray(@NonNull INDArray arr) throws IOException
arr
- the array to convertIOException
public static INDArray fromByteArray(@NonNull byte[] arr)
arr
- the array to read frompublic static INDArray readNumpy(@NonNull InputStream filePath, @NonNull String split) throws IOException
filePath
- the input stream ndarraysplit
- the split separatorIOException
public static INDArray readNumpy(@NonNull DataType dataType, @NonNull InputStream filePath, @NonNull String split, @NonNull Charset charset) throws IOException
dataType
- datatype of arrayfilePath
- the input streamsplit
- the split separatorcharset
- the charsetIOException
public static INDArray readNumpy(String filePath, String split) throws IOException
filePath
- the input stream ndarraysplit
- the split separatorIOException
public static INDArray readNumpy(DataType dataType, String filePath, String split) throws IOException
readNumpy(DataType, InputStream, String , Charset)
using standard UTF-8 encodingIOException
public static INDArray readNumpy(String filePath) throws IOException
filePath
- the input stream ndarrayIOException
public static INDArray readNumpy(DataType dataType, String filePath) throws IOException
readNumpy(DataType, InputStream, String , Charset)
with default split and UTF-8 encoding.IOException
public static INDArray read(InputStream reader)
read(DataInputStream)
public static INDArray readTxtString(InputStream ndarray)
ndarray
- the input stream ndarraypublic static INDArray readTxt(String filePath)
filePath
- the input stream ndarraypublic static INDArray createArrayFromShapeBuffer(DataBuffer data, DataBuffer shapeInfo)
data
- Data buffer.shapeInfo
- shape information.public static INDArray createArrayFromShapeBuffer(DataBuffer data, org.nd4j.linalg.primitives.Pair<DataBuffer,long[]> shapeInfo)
data
- data buffer.shapeInfo
- shape information.public static INDArray read(DataInputStream dis)
dis
- the data input stream to read frompublic static void write(INDArray arr, DataOutputStream dataOutputStream) throws IOException
arr
- the array to writedataOutputStream
- the data output stream to write toIOException
public static void saveBinary(INDArray arr, File saveTo) throws IOException
arr
- the array to savesaveTo
- the file to save toIOException
public static INDArray readBinary(File read) throws IOException
read
- the nd array to readIOException
public static void clearNans(INDArray arr)
arr
- the array to clearpublic static INDArray reverse(INDArray reverse)
reverse
- the matrix to reversepublic static INDArray arange(double begin, double end, double step)
begin
(inclusive) and end
(exclusive)
with a step size.begin
- the begin of the range (inclusive)end
- the end of the range (exclusive)step
- spacing between values. Default value is 1.public static INDArray arange(double begin, double end)
begin
(inclusive) and end
(exclusive)
with a step size of 1
See arange(double, double, double)
with step size 1.public static INDArray arange(double end)
end
(exclusive)
with a step size of 1
See arange(double, double, double)
with begin = 0 and step size 1.public static void copy(INDArray a, INDArray b)
a
- the origin matrixb
- the destination matrixpublic static INDArray diag(INDArray x)
x
- the diagonal valuespublic static INDArray choice(@NonNull INDArray source, @NonNull INDArray probs, @NonNull INDArray target, @NonNull Random rng)
source
- source array.probs
- array with probabilities.target
- destination array.rng
- Random number generator.public static INDArray choice(INDArray source, INDArray probs, INDArray target)
public static INDArray choice(INDArray source, INDArray probs, int numSamples, @NonNull Random rng)
numSamples
- number of samples to take. (size of the new NDArray).choice(INDArray, INDArray, int, org.nd4j.linalg.api.rng.Random)
public static INDArray choice(INDArray source, INDArray probs, int numSamples)
public static INDArray rand(@NonNull int... shape)
shape
- the shape of the arraypublic static INDArray rand(@NonNull long... shape)
rand(int[])
public static INDArray rand(@NonNull DataType dataType, @NonNull long... shape)
shape
- the shape of the ndarraypublic static INDArray rand(char order, @NonNull int... shape)
order
- the order of the ndarray to returnshape
- the shape of the array@Deprecated public static INDArray rand(@NonNull DataType dataType, int[] shape, char order)
@Deprecated public static INDArray rand(@NonNull DataType dataType, char order, @NonNull int... shape)
rand(org.nd4j.linalg.api.buffer.DataType, char, long...)
public static INDArray rand(@NonNull DataType dataType, char order, @NonNull long... shape)
order
- the order of the ndarray to returnshape
- the shape of the ndarraydataType
- the data type of the ndarraypublic static INDArray rand(@NonNull DataType dataType, @NonNull int... shape)
shape
- the shape of the ndarraydataType
- the data type of the ndarraypublic static INDArray rand(int rows, int columns)
rows
- the number of rows in the matrixcolumns
- the number of columns in the matrixpublic static INDArray rand(char order, int rows, int columns)
rows
- the number of rows in the matrixcolumns
- the number of columns in the matrixpublic static INDArray rand(long seed, @NonNull long... shape)
shape
- the shape of the arrayseed
- the seed to use@Deprecated public static INDArray rand(int[] shape, long seed)
rand(long, long...)
public static INDArray rand(int rows, int columns, long seed)
rows
- the number of rows in the matrixcolumns
- the columns of the ndarrayseed
- the seed to use@Deprecated public static INDArray rand(int[] shape, @NonNull Random rng)
rand(org.nd4j.linalg.api.rng.Random, long...)
public static INDArray rand(@NonNull Random rng, @NonNull long... shape)
shape
- the shape of the arrayrng
- the random generator to use@Deprecated public static INDArray rand(int[] shape, @NonNull Distribution dist)
rand(org.nd4j.linalg.api.rng.distribution.Distribution, long...)
@Deprecated public static INDArray rand(long[] shape, @NonNull Distribution dist)
rand(org.nd4j.linalg.api.rng.distribution.Distribution, long...)
public static INDArray rand(@NonNull Distribution dist, @NonNull long... shape)
shape
- the shape of the arraydist
- distribution to usepublic static INDArray rand(int rows, int columns, @NonNull Random rng)
rows
- the number of rows in the matrixcolumns
- the number of columns in the matrixrng
- the random generator to use@Deprecated public static INDArray rand(int[] shape, double min, double max, @NonNull Random rng)
rand(double, double, org.nd4j.linalg.api.rng.Random, long...)
@Deprecated public static INDArray rand(long[] shape, double min, double max, @NonNull Random rng)
rand(double, double, org.nd4j.linalg.api.rng.Random, long...)
public static INDArray rand(double min, double max, @NonNull Random rng, @NonNull long... shape)
shape
- the number of rows of the matrixmin
- the minimum numbermax
- the maximum numberrng
- the rng to usepublic static INDArray rand(int rows, int columns, double min, double max, @NonNull Random rng)
rows
- the number of rows of the matrixcolumns
- the number of columns in the matrixmin
- the minimum numbermax
- the maximum numberrng
- the rng to usepublic static INDArray randn(INDArray target)
target
- target arraypublic static INDArray randn(@NonNull int... shape)
shape
- the shape of the arraypublic static INDArray randn(@NonNull DataType dataType, @NonNull int... shape)
shape
- the shape of the ndarraypublic static INDArray randn(@NonNull DataType dataType, @NonNull long... shape)
dataType
- datatype to use, must be a float type datatype.shape
- shape for the new array.public static INDArray randn(@NonNull long... shape)
shape
- shape for the new array.public static INDArray randn(char order, @NonNull int... shape)
order
- order of the output ndarrayshape
- the shape of the arraypublic static INDArray randn(char order, @NonNull long... shape)
order
- order of the output ndarrayshape
- the shape of the arraypublic static INDArray randn(@NonNull DataType dataType, char order, @NonNull long... shape)
order
- order of the output ndarrayshape
- the shape of the ndarraydataType
- the data type of the ndarray@Deprecated public static INDArray randn(int[] shape, long seed)
randn(long, long...)
public static INDArray randn(long seed, @NonNull long... shape)
shape
- the shape of the arraypublic static INDArray randn(long rows, long columns)
rows
- the number of rows in the matrixcolumns
- the number of columns in the matrixpublic static INDArray randn(char order, long rows, long columns)
order
- the order of the output arrayrows
- the number of rows in the matrixcolumns
- the number of columns in the matrixpublic static INDArray randn(long rows, long columns, long seed)
rows
- the number of rows in the matrixcolumns
- the number of columns in the matrixpublic static INDArray randn(long rows, long columns, @NonNull Random r)
rows
- the number of rows in the matrixcolumns
- the number of columns in the matrixr
- the random generator to use@Deprecated public static INDArray randn(int[] shape, @NonNull Random r)
randn(org.nd4j.linalg.api.rng.Random, long...)
@Deprecated public static INDArray randn(long[] shape, @NonNull Random r)
randn(org.nd4j.linalg.api.rng.Random, long...)
public static INDArray randn(@NonNull Random r, @NonNull long... shape)
shape
- the shape of the arrayr
- the random generator to usepublic static INDArray rand(INDArray target)
target
- target arraypublic static INDArray rand(INDArray target, long seed)
target
- target arrayseed
- the seed to usepublic static INDArray rand(INDArray target, @NonNull Random rng)
target
- target arrayrng
- the random generator to usepublic static INDArray rand(INDArray target, @NonNull Distribution dist)
target
- target arraydist
- distribution to usepublic static INDArray rand(INDArray target, double min, double max, @NonNull Random rng)
target
- target arraymin
- the minimum numbermax
- the maximum numberrng
- the random generator to usepublic static INDArray randn(INDArray target, long seed)
target
- target arraypublic static INDArray randn(INDArray target, @NonNull Random rng)
target
- target arrayrng
- the random generator to usepublic static INDArray randomBernoulli(double p, @NonNull long... shape)
p
- Probability. Must be in range 0 to 1shape
- Shape of the result arraypublic static INDArray randomBernoulli(double p, @NonNull INDArray target)
p
- Probability. Must be in range 0 to 1target
- Result array to place generated values inpublic static INDArray randomBinomial(int nTrials, double p, @NonNull long... shape)
nTrials
- Number of trials. Must be >= 0p
- Probability. Must be in range 0 to 1shape
- Shape of the result arraypublic static INDArray randomBinomial(int nTrials, double p, INDArray target)
nTrials
- Number of trials. Must be >= 0p
- Probability. Must be in range 0 to 1target
- Result arraypublic static INDArray randomExponential(double lambda, long... shape)
lambda
- Must be > 0shape
- Shape of the array to generatepublic static INDArray randomExponential(double lambda, INDArray target)
lambda
- Must be > 0target
- Array to hold the resultpublic static INDArray createUninitialized(long rows, long columns)
rows
- rowscolumns
- columnspublic static INDArray create(float[] data)
data
- the columns of the ndarraypublic static INDArray create(boolean[] data)
data
- java boolean arraypublic static INDArray create(List<? extends Number> list)
list
- the columns of the ndarraypublic static INDArray create(double[] data)
data
- java double array,public static INDArray create(float[][] data)
data
- java 2d arrau.public static INDArray create(float[][] data, char ordering)
data
- java 2d arrau.ordering
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray create(double[][] data)
data
- the data to usepublic static INDArray create(long[][] data)
data
- java 2d long arraypublic static INDArray create(boolean[][] data)
data
- java 2d boolean array.public static INDArray create(boolean[][] data, @NonNull long... shape)
data
- java 2d boolean array.shape
- desired shape of new array.public static INDArray create(double[][][] data)
data
- java 3d double array.public static INDArray create(float[][][] data)
data
- java 3d float array.public static INDArray create(int[][][] data)
data
- java 3D i array.public static INDArray create(double[][][][] data)
data
- java 4D double array.public static INDArray create(float[][][][] data)
data
- java 4D float array.public static INDArray create(int[][][][] data)
data
- java 4D int array.public static INDArray create(double[][] data, char ordering)
data
- java 2D double array.ordering
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray create(int columns)
columns
- the columns of the ndarraypublic static INDArray create(float[] data, char order)
data
- the columns of the ndarrayorder
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray create(double[] data, char order)
data
- the columns of the ndarrayorder
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray create(int columns, char order)
columns
- the columns of the ndarrayorder
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray zeros(int columns, char order)
columns
- number of elements.order
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray create(int[] data, long[] shape, DataType type)
data
- java array used for initialisation. Must have at least the number of elements required.shape
- desired shape of new array.type
- Datatype of the new array. Does not need to match int. data will be converted.public static INDArray create(int[] data, long[] shape, long[] strides, char order, DataType type)
data
- java array used for initialisation. Must have at least the number of elements required.shape
- desired shape of new array.strides
- stride, separation of elements in each dimension.order
- Fortran 'f' or C/C++ 'c' ordering.type
- Datatype of the new array. Does not need to match int. data will be converted.public static INDArray create(long[] data, long[] shape, long[] strides, char order, DataType type)
public static INDArray create(double[] data, long[] shape, long[] strides, char order, DataType type)
public static INDArray create(float[] data, long[] shape, long[] strides, char order, DataType type)
public static INDArray create(short[] data, long[] shape, long[] strides, char order, DataType type)
public static INDArray create(byte[] data, long[] shape, long[] strides, char order, DataType type)
public static INDArray create(boolean[] data, long[] shape, long[] strides, char order, DataType type)
public static INDArray empty()
dataType()
public static INDArray empty(DataType type)
public static INDArray create(float[] data, int... shape)
data
- the data to use with tne ndarrayshape
- the shape of the arraypublic static INDArray create(float[] data, long... shape)
public static INDArray create(double[] data, long... shape)
public static INDArray create(double[] data, int... shape)
data
- the data to use with tne ndarrayshape
- the shape of the arraypublic static INDArray create(double[] data, int[] shape, long offset, char ordering)
data
- java array used for initialisation. Must have at least the number of elements required.shape
- desired shape of new array.offset
- the offset of data array used for initialisation.ordering
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray create(double[] data, long[] shape, long offset, char ordering)
public static INDArray create(float[] data, int[] shape, int[] stride, long offset)
data
- java array used for initialisation. Must have at least the number of elements required.shape
- desired shape of new array.stride
- stride, separation of elements in each dimension.offset
- the offset of data array used for initialisation.public static INDArray create(List<INDArray> list, int... shape)
list
- list of arrays.shape
- desired shape of new array. Must match the resulting shape of combining the list.public static INDArray create(int rows, int columns, int[] stride, long offset)
rows
- the rows of the ndarraycolumns
- the columns of the ndarraystride
- the stride for the ndarrayoffset
- the offset of the ndarraypublic static INDArray zeros(int rows, int columns, int[] stride, long offset)
public static INDArray create(int[] shape, int[] stride, long offset)
shape
- the shape of the ndarraystride
- the stride for the ndarrayoffset
- the offset of the ndarraypublic static INDArray zeros(int[] shape, int[] stride, long offset)
public static INDArray create(int rows, int columns, int[] stride)
rows
- the rows of the ndarraycolumns
- the columns of the ndarraystride
- the stride for the ndarraypublic static INDArray zeros(int rows, int columns, int[] stride)
#create(int, int, int[], char)
public static INDArray create(int[] shape, int[] stride)
shape
- the shape of the ndarraystride
- the stride for the ndarraypublic static INDArray create(long[] shape, long[] stride)
public static INDArray zeros(int[] shape, int[] stride)
public static INDArray create(int rows, int columns)
rows
- the rows of the ndarraycolumns
- the columns of the ndarraypublic static INDArray create(int... shape)
shape
- the shape of the arraypublic static INDArray create(long... shape)
shape
- the shape of the arraypublic static INDArray create(DataType type, long... shape)
type
- Datatype of the new array.shape
- desired shape of new array.public static INDArray create(DataBuffer data, int[] shape, int[] strides, long offset)
data
- data buffer used for initialisation. . Must have at least the number of elements required.shape
- desired shape of new array.strides
- stride, separation of elements in each dimension.offset
- the offset of data array used for initialisation.public static INDArray create(DataBuffer data, long[] shape, long[] strides, long offset)
public static INDArray create(DataBuffer data, int[] shape, long offset)
create(DataBuffer, int[], int[], long)
. Uses default strides based on shape.public static INDArray create(DataBuffer data, int[] newShape, int[] newStride, long offset, char ordering)
public static INDArray create(DataBuffer data, long[] newShape, long[] newStride, long offset, char ordering)
public static INDArray create(DataBuffer data, long[] newShape, long[] newStride, long offset, long ews, char ordering)
data
- data buffer used for initialisation. . Must have at least the number of elements required.newShape
- desired shape of new array.newStride
- stride, separation of elements in each dimension.offset
- the offset of data array used for initialisation.ews
- element wise stride.ordering
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray create(DataBuffer data, long[] newShape, long[] newStride, long offset, char ordering, DataType dataType)
data
- data buffer used for initialisation. . Must have at least the number of elements required.newShape
- desired shape of new array.newStride
- stride, separation of elements in each dimension.offset
- the offset of data array used for initialisation.ordering
- Fortran 'f' or C/C++ 'c' ordering.dataType
- data type.public static INDArray create(DataBuffer data, int... shape)
data
- data data buffer used for initialisation. . Must have at least the number of elements required.shape
- desired shape of new array.public static INDArray create(DataBuffer data, long... shape)
public static INDArray create(DataBuffer buffer)
buffer
- data data buffer used for initialisation.public static INDArray create(int[] shape, DataType dataType)
shape
- desired shape of new array.dataType
- data type.public static INDArray zeros(int[] shape, DataType dataType)
create(int[], DataType)
public static INDArray create(double[] data, int[] shape, char ordering)
data
- java array used for initialisation. Must have at least the number of elements required.shape
- desired shape of new array.ordering
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray create(float[] data, int[] shape, char ordering)
public static INDArray create(float[] data, long[] shape, char ordering)
public static INDArray create(double[] data, long[] shape, char ordering)
public static INDArray create(long[] shape, long[] stride, long offset, char ordering)
shape
- the shape of the ndarraystride
- the stride for the ndarrayoffset
- the offset of the ndarraypublic static INDArray create(int rows, int columns, int[] stride, char ordering)
rows
- number of rows.columns
- number of columnsstride
- stride, separation of elements in each dimension.ordering
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray create(int[] shape, int[] stride, char ordering)
shape
- the shape of the ndarraystride
- the stride for the ndarrayordering
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray create(long[] shape, long[] stride, char ordering)
public static INDArray create(long rows, long columns, char ordering)
rows
- the rows of the ndarraycolumns
- the columns of the ndarrayordering
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray zeros(int rows, int columns, char ordering)
rows
- the rows of the ndarraycolumns
- the columns of the ndarrayordering
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray create(@NonNull int[] shape, char ordering)
shape
- the shape of the arrayordering
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray create(@NonNull long[] shape, char ordering)
shape
- the shape of the arrayordering
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray create(DataType dataType, @NonNull long[] shape, long[] strides, char ordering)
dataType
- data type.shape
- the shape of the arraystrides
- stride, separation of elements in each dimension.ordering
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray create(@NonNull DataType dataType, @NonNull long[] shape, char ordering)
dataType
- data type.shape
- the shape of the arrayordering
- Fortran 'f' or C/C++ 'c' ordering.public static void checkShapeValues(long... shape)
shape
- to checkpublic static INDArray createUninitialized(int[] shape, char ordering)
shape
- the shape of the arrayordering
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray createUninitialized(DataType type, long[] shape, char ordering)
type
- data typeshape
- the shape of the arrayordering
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray createUninitialized(long[] shape, char ordering)
shape
- the shape of the arrayordering
- Fortran 'f' or C/C++ 'c' ordering.public static INDArray createUninitialized(int... shape)
public static INDArray createUninitialized(long... shape)
shape
- the shape of the arraypublic static INDArray createUninitialized(int length)
public static INDArray createUninitialized(long length)
length
- length of array to createpublic static INDArray createUninitializedDetached(DataType dataType, char ordering, long... shape)
dataType
- data type. Exceptions will be thrown for UTF8, COMPRESSED and UNKNOWN data types.ordering
- Fortran 'f' or C/C++ 'c' ordering.shape
- the shape of the array.public static INDArray createUninitializedDetached(DataType dataType, long... shape)
createUninitializedDetached(DataType, char, long...)
with default ordering.public static INDArray zeros(long rows, long columns)
rows
- number of rows.columns
- number of columns.public static INDArray zeros(int columns)
columns
- number of columns.public static INDArray zeros(DataType dataType, int columns)
dataType
- data type.columns
- number of columns.public static INDArray zeros(DataType dataType, @NonNull long... shape)
dataType
- data type.shape
- the shape of the arraypublic static INDArray valueArrayOf(int[] shape, double value)
shape
- the shape of the arrayvalue
- the value to assignpublic static INDArray valueArrayOf(long[] shape, float value)
shape
- the shape of the arrayvalue
- the value to assignpublic static INDArray valueArrayOf(long[] shape, int value)
shape
- the shape of the arrayvalue
- the value to assignpublic static INDArray valueArrayOf(long[] shape, double value)
public static INDArray valueArrayOf(long[] shape, double value, DataType type)
shape
- the shape of the arrayvalue
- the value to assigntype
- data typepublic static INDArray valueArrayOf(long num, double value)
num
- number of columnsvalue
- the value to assignpublic static INDArray valueArrayOf(long rows, long columns, double value)
rows
- the number of rows in the matrixcolumns
- the columns of the ndarrayvalue
- the value to assignpublic static INDArray ones(int rows, int columns)
rows
- the number of rows in the matrixcolumns
- the columns of the ndarraypublic static INDArray ones(DataType dataType, int rows, int columns)
dataType
- data typerows
- rows of the new array.columns
- columns of the new arrau.public static INDArray zerosLike(INDArray arr)
arr
- the array to create the ones likepublic static INDArray onesLike(INDArray arr)
arr
- the array to create the ones likepublic static INDArray ones(DataType dataType, @NonNull long... shape)
shape
- Shape fo the arraypublic static INDArray hstack(@NonNull INDArray... arrs)
arrs
- the first matrix to concatpublic static INDArray hstack(Collection<INDArray> arrs)
arrs
- the first matrix to concatpublic static INDArray vstack(@NonNull INDArray... arrs)
pile(INDArray...)
. Example: vstack([3],[3]) -> [2,3]arrs
- Arrays to vstackpublic static INDArray vstack(Collection<INDArray> arrs)
pile(INDArray...)
. Example: vstack([3],[3]) -> [2,3]arrs
- Arrays to vstackpublic static INDArray averageAndPropagate(INDArray[] arrays)
arrays
- arrays to averagepublic static INDArray averageAndPropagate(Collection<INDArray> arrays)
arrays
- arrays to averagepublic static INDArray averageAndPropagate(INDArray target, Collection<INDArray> arrays)
arrays
- arrays to averagepublic static INDArray stripOnes(INDArray toStrip)
toStrip
- the ndarray to newShapeNoCopypublic static INDArray accumulate(@NonNull INDArray... arrays)
arrays
- array to accumulatepublic static INDArray accumulate(INDArray target, Collection<INDArray> arrays)
target
- result arrayarrays
- arrays to sumpublic static INDArray accumulate(INDArray target, INDArray[] arrays)
target
- result arrayarrays
- arrays to sumpublic static INDArray pullRows(INDArray source, int sourceDimension, @NonNull int... indexes)
source
- source tensorsourceDimension
- dimension of source tensorindexes
- indexes from source arraypublic static INDArray pullRows(INDArray source, int sourceDimension, int[] indexes, char order)
source
- source tensorsourceDimension
- dimension of source tensorindexes
- indexes from source arraypublic static INDArray pullRows(INDArray source, INDArray destination, int sourceDimension, @NonNull int... indexes)
source
- source tensordestination
- Destination tensor (result will be placed here)sourceDimension
- dimension of source tensorindexes
- indexes from source arraypublic static INDArray stack(int axis, @NonNull INDArray... values)
axis
- Axis to stack onvalues
- Input variables to stack. Must have the same shape for all inputsconcat(int, INDArray...)
public static INDArray concat(int dimension, @NonNull INDArray... toConcat)
dimension
- the dimension to concatneate alongtoConcat
- the ndarrays to concatpublic static INDArray specialConcat(int dimension, @NonNull INDArray... toConcat)
dimension
- dimensiontoConcat
- arrayts to concatenatepublic static INDArray zeros(int[] shape, char order)
shape
- the shape of the arraypublic static INDArray zeros(long[] shape, char order)
public static INDArray zeros(@NonNull int... shape)
shape
- the shape of the arraypublic static INDArray zeros(@NonNull long... shape)
shape
- the shape of the arraypublic static INDArray ones(@NonNull int... shape)
shape
- the shape of the arraypublic static INDArray ones(@NonNull long... shape)
public static INDArray scalar(Number value)
value
- the value to initialize the scalar withpublic static INDArray scalar(DataType dataType, Number value)
value
- the value to initialize the scalar withpublic static INDArray scalar(double value)
value
- the value of the scalarpublic static INDArray scalar(float value)
value
- the value of the scalarpublic static INDArray scalar(boolean value)
value
- the value of the scalarpublic static INDArray scalar(int value)
value
- the value of the scalarpublic static INDArray scalar(long value)
value
- the value of the scalarpublic static int[] getStrides(int[] shape, char order)
shape
- the shape of the arrayorder
- the order to getScalar the strides forpublic static long[] getStrides(long[] shape, char order)
public static int[] getStrides(@NonNull int... shape)
shape
- the shape of the arraypublic static long[] getStrides(@NonNull long... shape)
shape
- the shape of the arraypublic static INDArray tile(INDArray tile, @NonNull int... repeat)
tile
- the ndarray to tilerepeat
- the shape to repeatpublic void initWithBackend(Nd4jBackend backend)
backend
- the backend to initialize withpublic static ShapeInfoProvider getShapeInfoProvider()
public static SparseInfoProvider getSparseInfoProvider()
public static ConstantHandler getConstantHandler()
public static AffinityManager getAffinityManager()
public static NDArrayFactory getNDArrayFactory()
public static BasicNDArrayCompressor getCompressor()
public static MemoryManager getMemoryManager()
@Deprecated public static int sizeOfDataType()
public static int sizeOfDataType(DataType dtype)
dtype
- number of bytes per elementpublic static void enableFallbackMode(boolean reallyEnable)
reallyEnable
- fallback modepublic static boolean isFallbackModeEnabled()
public static MemoryWorkspaceManager getWorkspaceManager()
public static INDArray pile(@NonNull INDArray... arrays)
arrays
- arrays to stackpublic static INDArray pile(@NonNull Collection<INDArray> arrays)
arrays
- arrays to stackpublic static INDArray[] tear(INDArray tensor, @NonNull int... dimensions)
tensor
- Array to teardimensions
- dimensionspublic static INDArray triu(INDArray m, int k)
m
- source arrayk
- to zero below the k-th diagonalpublic static INDArray tri(int n)
tri(int,int,int)
with m = n, k=0.public static INDArray tri(int n, int k)
tri(int,int,int)
with m = n.public static INDArray tri(int n, int m, int k)
n
- number of rows in the arraym
- number of columns in the array ( can be just equal to n)k
- The sub-diagonal at and below which the array is filled.
`k` = 0 is the main diagonal, while `k` < 0 is below it,
and `k` > 0 is above. The default is 0.public static INDArray[] where(INDArray condition, INDArray x, INDArray y)
out[i] = (condition[i] != 0 ? x[i] : y[i])
condition
- Condition arrayx
- X array. If null, y must be null also.y
- Y array. If null, x must be null alsopublic static void writeAsNumpy(INDArray arr, File file) throws IOException
arr
- the array to write in Numpy .npy formatfile
- the file to write toIOException
- if an error occurs when writing the filepublic static org.bytedeco.javacpp.Pointer convertToNumpy(INDArray arr)
INDArray
to a numpy struct.arr
- the array to convertpublic static void writeAsNumpy(INDArray arr, OutputStream writeTo) throws IOException
arr
- the array to writewriteTo
- the output stream to write toIOException
public static INDArray createFromNpyPointer(org.bytedeco.javacpp.Pointer pointer)
pointer
- the pointer to the
numpy arraypublic static INDArray createFromNpyFile(File file)
file
- the file to create the ndarray frompublic static Map<String,INDArray> createFromNpzFile(File file) throws Exception
Exception
public static INDArray createNpyFromInputStream(InputStream is) throws IOException
is
- the input stream to readIOException
public static INDArray createNpyFromByteArray(byte[] input)
INDArray
from the given numpy input.input
- the input byte array with the npy formatINDArray
public static byte[] toNpyByteArray(INDArray input)
INDArray
to a byte arrayinput
- the input arrayINDArray
as a byte array
with the numpy format.
For more on the format, see: https://docs.scipy.org/doc/numpy-1.14.0/neps/npy-format.htmlpublic static DataType defaultFloatingPointType()
public static boolean isPrecisionBoostAllowed()
public static INDArray create(@NonNull Collection<String> strings, long... shape)
public static INDArray create(@NonNull Collection<String> strings, long[] shape, char order)
public static INDArray createFromArray(double... array)
array
- jvm arraypublic static INDArray createFromArray(float... array)
array
- jvm arraypublic static INDArray createFromArray(int... array)
array
- jvm arraypublic static INDArray createFromArray(short... array)
array
- jvm arraypublic static INDArray createFromArray(byte... array)
array
- jvm arraypublic static INDArray createFromArray(long... array)
array
- jvm arraypublic static INDArray createFromArray(boolean... array)
array
- jvm arraypublic static INDArray createFromArray(double[][] array)
array
- jvm arraypublic static INDArray createFromArray(float[][] array)
array
- jvm arraypublic static INDArray createFromArray(long[][] array)
array
- jvm arraypublic static INDArray createFromArray(int[][] array)
array
- jvm arraypublic static INDArray createFromArray(short[][] array)
array
- jvm arraypublic static INDArray createFromArray(byte[][] array)
array
- jvm arraypublic static INDArray createFromArray(boolean[][] array)
array
- jvm arraypublic static INDArray createFromArray(double[][][] array)
array
- jvm arraypublic static INDArray createFromArray(float[][][] array)
array
- jvm arraypublic static INDArray createFromArray(long[][][] array)
array
- jvm arraypublic static INDArray createFromArray(int[][][] array)
array
- jvm arraypublic static INDArray createFromArray(short[][][] array)
array
- jvm arraypublic static INDArray createFromArray(byte[][][] array)
array
- jvm arraypublic static INDArray createFromArray(boolean[][][] array)
array
- jvm arraypublic static INDArray createFromArray(double[][][][] array)
array
- jvm arraypublic static INDArray createFromArray(float[][][][] array)
array
- jvm arraypublic static INDArray createFromArray(long[][][][] array)
array
- jvm arraypublic static INDArray createFromArray(int[][][][] array)
array
- jvm arraypublic static INDArray createFromArray(short[][][][] array)
array
- jvm arraypublic static INDArray createFromArray(byte[][][][] array)
array
- jvm arraypublic static INDArray createFromArray(boolean[][][][] array)
array
- jvm arraypublic static DeallocatorService getDeallocatorService()
public static INDArray createFromArray(Double[] array)
array
- jvm arraypublic static INDArray createFromArray(Float[] array)
array
- jvm arraypublic static INDArray createFromArray(Integer[] array)
array
- jvm arraypublic static INDArray createFromArray(Short[] array)
array
- jvm arraypublic static INDArray createFromArray(Byte[] array)
array
- jvm arraypublic static INDArray createFromArray(Long[] array)
array
- jvm arraypublic static INDArray createFromArray(Boolean[] array)
array
- jvm arraypublic static INDArray createFromArray(Double[][] array)
array
- jvm arraypublic static INDArray createFromArray(Float[][] array)
array
- jvm arraypublic static INDArray createFromArray(Integer[][] array)
array
- jvm arraypublic static INDArray createFromArray(Short[][] array)
array
- jvm arraypublic static INDArray createFromArray(Byte[][] array)
array
- jvm arraypublic static INDArray createFromArray(Long[][] array)
array
- jvm arraypublic static INDArray createFromArray(Boolean[][] array)
array
- jvm arraypublic static INDArray createFromArray(Double[][][] array)
array
- jvm arraypublic static INDArray createFromArray(Float[][][] array)
array
- jvm arraypublic static INDArray createFromArray(Integer[][][] array)
array
- jvm arraypublic static INDArray createFromArray(Short[][][] array)
array
- jvm arraypublic static INDArray createFromArray(Byte[][][] array)
array
- jvm arraypublic static INDArray createFromArray(Long[][][] array)
array
- jvm arraypublic static INDArray createFromArray(Boolean[][][] array)
array
- jvm arraypublic static INDArray createFromArray(Double[][][][] array)
array
- jvm arraypublic static INDArray createFromArray(Float[][][][] array)
array
- jvm arraypublic static INDArray createFromArray(Integer[][][][] array)
array
- jvm arraypublic static INDArray createFromArray(Short[][][][] array)
array
- jvm arraypublic static INDArray createFromArray(Byte[][][][] array)
array
- jvm arraypublic static INDArray createFromArray(Long[][][][] array)
array
- jvm arraypublic static INDArray createFromArray(Boolean[][][][] array)
array
- jvm arraypublic static boolean isExperimentalMode()
public static INDArray exec(Op op)
op
- the operation to executepublic static INDArray[] exec(CustomOp op)
op
- the operation to executepublic static INDArray[] exec(CustomOp op, OpContext context)
op
- the operation to execute@Deprecated public static void scatterUpdate(ScatterUpdate.UpdateOp op, @NonNull INDArray array, @NonNull INDArray indices, @NonNull INDArray updates, int... axis)
Copyright © 2019. All rights reserved.