Package org.nd4j.linalg.factory
Interface NDArrayFactory
-
- All Known Implementing Classes:
BaseNDArrayFactory
public interface NDArrayFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description INDArrayaccumulate(INDArray target, INDArray... arrays)This method sums given arrays to targetINDArrayappendBias(INDArray... vectors)INDArrayarange(double begin, double end, double step)Array of evenly spaced values.INDArrayaverage(Collection<INDArray> arrays)This method averages input arrays, and returns averaged arrayINDArrayaverage(INDArray[] arrays)This method averages input arrays, and returns averaged arrayINDArrayaverage(INDArray target, Collection<INDArray> arrays)This method averages input arrays, and returns averaged arrayINDArrayaverage(INDArray target, INDArray[] arrays)This method averages input arrays, and returns averaged arrayINDArraybilinearProducts(INDArray curr, INDArray in)Returns a column vector where each entry is the nth bilinear product of the nth slices of the two tensors.Blasblas()Return extra blas operationsINDArrayconcat(int dimension, INDArray... toConcat)Concatneate ndarrays along a dimensionvoidconvertDataEx(DataTypeEx typeSrc, org.bytedeco.javacpp.Pointer source, DataTypeEx typeDst, org.bytedeco.javacpp.Pointer target, long length)voidconvertDataEx(DataTypeEx typeSrc, org.bytedeco.javacpp.Pointer source, DataTypeEx typeDst, DataBuffer buffer)DataBufferconvertDataEx(DataTypeEx typeSrc, DataBuffer source, DataTypeEx typeDst)voidconvertDataEx(DataTypeEx typeSrc, DataBuffer source, DataTypeEx typeDst, DataBuffer target)INDArrayconvertDataEx(DataTypeEx typeSrc, INDArray source, DataTypeEx typeDst)org.bytedeco.javacpp.PointerconvertToNumpy(INDArray array)Convert anINDArrayto a numpy array.voidcopy(INDArray a, INDArray b)Copy a to bINDArraycreate(boolean[] data, long[] shape, long[] stride, char order, DataType dataType, MemoryWorkspace workspace)INDArraycreate(boolean[] data, long[] shape, long[] stride, DataType dataType, MemoryWorkspace workspace)INDArraycreate(byte[] data, long[] shape, long[] stride, char order, DataType dataType, MemoryWorkspace workspace)INDArraycreate(byte[] data, long[] shape, long[] stride, DataType dataType, MemoryWorkspace workspace)INDArraycreate(double[] data)Creates a row vector with the dataINDArraycreate(double[][] data)Create an ndarray with the given data layoutINDArraycreate(double[][] data, char ordering)Create a matrix from the given data and orderingINDArraycreate(double[] data, char order)INDArraycreate(double[] data, int[] shape)Create an ndrray with the specified shapeINDArraycreate(double[] data, int[] shape, char ordering)INDArraycreate(double[] data, int[] shape, int[] stride, char order, long offset)INDArraycreate(double[] data, int[] shape, int[] stride, long offset)Creates an ndarray with the specified shapeINDArraycreate(double[] data, int[] shape, int[] stride, long offset, char ordering)INDArraycreate(double[] data, int[] shape, long offset)INDArraycreate(double[] data, long[] shape)INDArraycreate(double[] data, long[] shape, char ordering)INDArraycreate(double[] data, long[] shape, long[] stride, char order, DataType dataType, MemoryWorkspace workspace)INDArraycreate(double[] data, long[] shape, long[] stride, long offset)INDArraycreate(double[] data, long[] shape, long[] stride, long offset, char ordering)INDArraycreate(double[] data, long[] shape, long[] stride, DataType dataType, MemoryWorkspace workspace)INDArraycreate(double[] data, long[] shape, long offset, Character order)INDArraycreate(double[] data, long rows, long columns, int[] stride, long offset)Creates an ndarray with the specified shapeINDArraycreate(float[] data)Creates a row vector with the dataINDArraycreate(float[][] floats)INDArraycreate(float[][] data, char ordering)INDArraycreate(float[] data, char order)INDArraycreate(float[] data, int[] shape)Create an ndrray with the specified shapeINDArraycreate(float[] data, int[] shape, char ordering)INDArraycreate(float[] data, int[] shape, int[] stride, char order, long offset)INDArraycreate(float[] data, int[] shape, int[] stride, long offset)Creates an ndarray with the specified shapeINDArraycreate(float[] data, int[] shape, int[] stride, long offset, char ordering)INDArraycreate(float[] data, int[] shape, long offset)INDArraycreate(float[] data, int[] shape, long offset, Character order)INDArraycreate(float[] data, long[] shape)INDArraycreate(float[] data, long[] shape, char ordering)INDArraycreate(float[] data, long[] shape, long[] stride, char order, long offset)INDArraycreate(float[] data, long[] shape, long[] stride, char order, DataType dataType)INDArraycreate(float[] data, long[] shape, long[] stride, char order, DataType dataType, MemoryWorkspace workspace)INDArraycreate(float[] data, long[] shape, long[] stride, long offset)INDArraycreate(float[] data, long[] shape, long[] stride, long offset, char ordering)INDArraycreate(float[] data, long[] shape, long[] stride, DataType dataType, MemoryWorkspace workspace)INDArraycreate(float[] data, long[] shape, long offset, Character order)INDArraycreate(float[] data, long rows, long columns, int[] stride, long offset)INDArraycreate(float[] data, long rows, long columns, int[] stride, long offset, char ordering)INDArraycreate(int[] shape)Creates an ndarray with the specified shapeINDArraycreate(int[] shape, char ordering)INDArraycreate(int[] shape, int[] stride)Creates an ndarray with the specified shapeINDArraycreate(int[] shape, int[] ints1, int[] stride, char order, long offset)INDArraycreate(int[] ints, int[] ints1, int[] stride, long offset)INDArraycreate(int[] shape, int[] stride, long offset)Creates an ndarray with the specified shapeINDArraycreate(int[] shape, int[] stride, long offset, char ordering)INDArraycreate(int[] data, long[] shape, long[] stride, char order, DataType dataType, MemoryWorkspace workspace)INDArraycreate(int[] data, long[] shape, long[] stride, DataType dataType, MemoryWorkspace workspace)INDArraycreate(int[] shape, DataBuffer buffer)Create an ndarray with the given shape and dataINDArraycreate(int[] shape, DataType dataType, MemoryWorkspace workspace)INDArraycreate(long columns)Creates a row vector with the specified number of columnsINDArraycreate(long[] shape)INDArraycreate(long[] shape, char ordering)INDArraycreate(long[] shape, long[] stride)INDArraycreate(long[] shape, long[] stride, long offset)INDArraycreate(long[] data, long[] shape, long[] stride, char order, DataType dataType, MemoryWorkspace workspace)INDArraycreate(long[] data, long[] shape, long[] stride, DataType dataType, MemoryWorkspace workspace)INDArraycreate(long[] shape, long[] stride, long offset, char ordering)INDArraycreate(long rows, long columns)Creates an ndarray with the specified shapeINDArraycreate(long rows, long columns, char ordering)INDArraycreate(long rows, long columns, int[] stride)Creates an ndarray with the specified shapeINDArraycreate(long rows, long columns, int[] stride, long offset)Creates an ndarray with the specified shapeINDArraycreate(long rows, long columns, long[] stride, long offset)INDArraycreate(short[] data, long[] shape, long[] stride, char order, DataType dataType, MemoryWorkspace workspace)INDArraycreate(short[] data, long[] shape, long[] stride, DataType dataType, MemoryWorkspace workspace)INDArraycreate(Collection<String> strings, long[] shape, char order)INDArraycreate(List<INDArray> list, int[] shape)Creates an ndarray with the specified shapeINDArraycreate(List<INDArray> list, int[] shape, char ordering)INDArraycreate(List<INDArray> list, long[] shape)INDArraycreate(List<INDArray> list, long[] shape, char ordering)INDArraycreate(DataBuffer data)Creates a row vector with the dataINDArraycreate(DataBuffer data, int[] shape)Create an ndrray with the specified shapeINDArraycreate(DataBuffer buffer, int[] shape, int[] stride, char order, long offset)INDArraycreate(DataBuffer data, int[] shape, int[] stride, long offset)Creates an ndarray with the specified shapeINDArraycreate(DataBuffer data, int[] newShape, int[] newStride, long offset, char ordering)INDArraycreate(DataBuffer buffer, int[] shape, long offset)INDArraycreate(DataBuffer data, long[] shape)INDArraycreate(DataBuffer data, long[] shape, long[] stride, long offset)INDArraycreate(DataBuffer data, long[] newShape, long[] newStride, long offset, char ordering)INDArraycreate(DataBuffer data, long[] newShape, long[] newStride, long offset, char ordering, DataType dataType)INDArraycreate(DataBuffer data, long[] newShape, long[] newStride, long offset, long ews, char ordering)INDArraycreate(DataBuffer data, long rows, long columns, int[] stride, long offset)Creates an ndarray with the specified shapeINDArraycreate(DataType dataType, long[] shape, char ordering, MemoryWorkspace workspace)INDArraycreate(DataType dataType, long[] shape, long[] strides, char ordering, MemoryWorkspace workspace)INDArraycreate(DataType dataType, long[] shape, long[] paddings, long[] paddingOffsets, char ordering, MemoryWorkspace workspace)Create an ndArray with padded BuffervoidcreateBlas()Create blasINDArraycreateFromNpyFile(File file)Create from a given numpy file.INDArraycreateFromNpyHeaderPointer(org.bytedeco.javacpp.Pointer pointer)Create from an in memory numpy header.INDArraycreateFromNpyPointer(org.bytedeco.javacpp.Pointer pointer)Create from an in memory numpy pointerMap<String,INDArray>createFromNpzFile(File file)Create a Mapfrom given npz file. voidcreateLapack()Create lapackvoidcreateLevel1()Create level 1voidcreateLevel2()Create level 2voidcreateLevel3()Create level 3INDArraycreateUninitialized(int[] shape, char ordering)INDArraycreateUninitialized(long[] shape, char ordering)INDArraycreateUninitialized(DataType dataType, long[] shape, char ordering, MemoryWorkspace workspace)INDArraycreateUninitializedDetached(DataType dataType, char ordering, long... shape)Create an uninitialized ndArray.DataTypedtype()Returns the data opType for this ndarrayINDArrayempty(DataType type)INDArrayeye(long n)Create the identity ndarrayINDArrayhstack(INDArray... arrs)Concatenates two matrices horizontally.Lapacklapack()Level1level1()Return the level 1 blas operationsLevel2level2()Return the level 2 blas operationsLevel3level3()Return the level 3 blas operationsINDArrayones(int[] shape)Create an ndarray of onesINDArrayones(long columns)Creates a row vector with the specified number of columnsINDArrayones(long[] shape)INDArrayones(long rows, long columns)Creates a row vector with the specified number of columnscharorder()Returns the order for this ndarray for internal data storageINDArraypullRows(INDArray source, int sourceDimension, int[] indexes)This method produces concatenated array, that consist from tensors, fetched from source array, against some dimension and specified indexesINDArraypullRows(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 indexesINDArraypullRows(INDArray source, int sourceDimension, long[] indexes)INDArraypullRows(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 in to the destination arrayINDArrayrand(char order, int[] shape)Create a random ndarray with the given shape, and specified output orderINDArrayrand(char order, long[] shape)Create a random ndarray with the given shape and specified output orderINDArrayrand(char order, long rows, long columns)Create a random (uniform 0-1) NDArray with the specified shape and orderINDArrayrand(int[] shape)Create a random ndarray with the given shape using the current time as the seedINDArrayrand(int[] shape, double min, double max, Random rng)INDArrayrand(int[] shape, float min, float max, Random rng)Generates a random matrix between min and maxINDArrayrand(int[] shape, long seed)Create a random ndarray with the given shape using the given rngINDArrayrand(int[] shape, Distribution r)Create a random ndarray with the given shape using the given rngINDArrayrand(int[] shape, Random r)Create a random ndarray with the given shape using the given rngINDArrayrand(long[] shape)Create a random ndarray with the given shape using the current time as the seedINDArrayrand(long[] shape, double min, double max, Random rng)INDArrayrand(long[] shape, float min, float max, Random rng)INDArrayrand(long[] shape, long seed)INDArrayrand(long[] shape, Random r)INDArrayrand(long rows, long columns)Create a random ndarray with the given shape using the current time as the seedINDArrayrand(long rows, long columns, double min, double max, Random rng)INDArrayrand(long rows, long columns, float min, float max, Random rng)Generates a random matrix between min and maxINDArrayrand(long rows, long columns, long seed)Create a random ndarray with the given shape using the given rngINDArrayrand(long rows, long columns, Random r)Create a random ndarray with the given shape using the given rngINDArrayrandn(char order, int[] shape)Random normal N(0,1) with the specified shape and orderINDArrayrandn(char order, long[] shape)Random normal N(0,1) with the specified shape and orderINDArrayrandn(char order, long rows, long columns)Random normal N(0,1), with specified output orderINDArrayrandn(int[] shape)Random normal N(0,1) using the current time stamp as the seedINDArrayrandn(int[] shape, long seed)Random normal using the specified seedINDArrayrandn(int[] shape, Random r)Random normal using the given rngINDArrayrandn(long[] shape)Random normal N(0,1) using the current time stamp as the seedINDArrayrandn(long[] shape, long seed)Random normal using the specified seedINDArrayrandn(long[] shape, Random r)INDArrayrandn(long rows, long columns)Random normal (N(0,1)) using the current time stamp as the seedINDArrayrandn(long rows, long columns, long seed)Random normal using the specified seedINDArrayrandn(long rows, long columns, Random r)Random normal using the given rngINDArrayreverse(INDArray reverse)Reverses the passed in matrix such that m[0] becomes m[m.length - 1] etcINDArrayrot(INDArray reverse)Reverses the passed in matrix such that m[0] becomes m[m.length - 1] etcvoidrot90(INDArray toRotate)Rotate a matrix 90 degreesINDArrayscalar(double value)Create a scalar nd array with the specified value and offsetINDArrayscalar(double value, long offset)Create a scalar nd array with the specified value and offsetINDArrayscalar(float value)Create a scalar nd array with the specified value and offsetINDArrayscalar(float value, long offset)Create a scalar nd array with the specified value and offsetINDArrayscalar(int value, long offset)INDArrayscalar(Number value)Create a scalar ndarray with the specified offsetINDArrayscalar(DataType dataType)Create a scalar nd array with the data type and a default value depending on the data type.voidsetDType(DataType dtype)Sets the data opTypevoidsetOrder(char order)Sets the order.voidshuffle(Collection<INDArray> array, Random rnd, int... dimension)Symmetric in place shuffle of an ndarray along a specified set of dimensions.voidshuffle(List<INDArray> array, Random rnd, List<int[]> dimensions)Symmetric in place shuffle of an ndarray along a specified set of dimensions.voidshuffle(INDArray array, Random rnd, int... dimension)In place shuffle of an ndarray along a specified set of dimensionsINDArraysort(INDArray x, boolean descending)INDArraysort(INDArray x, boolean descending, int... dimensions)INDArraysortCooIndices(INDArray x)INDArrayspecialConcat(int dimension, INDArray... toConcat)Concatenate ndarrays along a dimension PLEASE NOTE: This method is special for GPU backend, it works on HOST side only.INDArray[]tear(INDArray tensor, int... dimensions)INDArraytoFlattened(char order, Collection<INDArray> matrices)Returns a flattened ndarray with all elements in each ndarray regardless of dimension.INDArraytoFlattened(char order, INDArray... matrices)Flatten all of the ndarrays in to one long vectorINDArraytoFlattened(int length, Iterator<? extends INDArray>... matrices)Returns a flattened ndarray with all of the elements in each ndarray regardless of dimensionINDArraytoFlattened(Collection<INDArray> matrices)/** Returns a flattened ndarray with all of the elements in each ndarray regardless of dimensionINDArraytoFlattened(INDArray... matrices)Flatten all of the ndarrays in to one long vectorINDArrayvalueArrayOf(int[] shape, double value)Creates an ndarray with the specified value as the only value in the ndarrayINDArrayvalueArrayOf(long[] shape, double value)INDArrayvalueArrayOf(long rows, long columns, double value)Creates a row vector with the specified number of columnsINDArrayvstack(INDArray... arrs)Concatenates two matrices vertically.INDArrayzeros(int[] shape)Create an ndarray of zerosINDArrayzeros(long columns)Creates a row vector with the specified number of columnsINDArrayzeros(long[] shape)INDArrayzeros(long rows, long columns)Creates a row vector with the specified number of columns
-
-
-
Field Detail
-
FORTRAN
static final char FORTRAN
- See Also:
- Constant Field Values
-
C
static final char C
- See Also:
- Constant Field Values
-
-
Method Detail
-
blas
Blas blas()
Return extra blas operations- Returns:
-
lapack
Lapack lapack()
-
level1
Level1 level1()
Return the level 1 blas operations- Returns:
-
level2
Level2 level2()
Return the level 2 blas operations- Returns:
-
level3
Level3 level3()
Return the level 3 blas operations- Returns:
-
createBlas
void createBlas()
Create blas
-
createLevel1
void createLevel1()
Create level 1
-
createLevel2
void createLevel2()
Create level 2
-
createLevel3
void createLevel3()
Create level 3
-
createLapack
void createLapack()
Create lapack
-
setOrder
void setOrder(char order)
Sets the order. Primarily for testing purposes- Parameters:
order-
-
setDType
void setDType(DataType dtype)
Sets the data opType- Parameters:
dtype-
-
create
INDArray create(int[] shape, DataBuffer buffer)
Create an ndarray with the given shape and data- Parameters:
shape- the shape to usebuffer- the buffer to use- Returns:
- the ndarray
-
order
char order()
Returns the order for this ndarray for internal data storage- Returns:
- the order (c or f)
-
dtype
DataType dtype()
Returns the data opType for this ndarray- Returns:
- the data opType for this ndarray
-
toFlattened
INDArray toFlattened(Collection<INDArray> matrices)
/** Returns a flattened ndarray with all of the elements in each ndarray regardless of dimension- Parameters:
matrices- the ndarrays to use- Returns:
- a flattened ndarray of the elements in the order of titerating over the ndarray and the linear view of each
-
toFlattened
INDArray toFlattened(int length, Iterator<? extends INDArray>... matrices)
Returns a flattened ndarray with all of the elements in each ndarray regardless of dimension- Parameters:
matrices- the ndarrays to use- Returns:
- a flattened ndarray of the elements in the order of titerating over the ndarray and the linear view of each
-
toFlattened
INDArray toFlattened(char order, Collection<INDArray> matrices)
Returns a flattened ndarray with all elements in each ndarray regardless of dimension. Order is specified to ensure flattening order is consistent across- Parameters:
matrices- the ndarrays to flattenorder- the order in which the ndarray values should be flattened- Returns:
-
bilinearProducts
INDArray bilinearProducts(INDArray curr, INDArray in)
Returns a column vector where each entry is the nth bilinear product of the nth slices of the two tensors.
-
toFlattened
INDArray toFlattened(INDArray... matrices)
Flatten all of the ndarrays in to one long vector- Parameters:
matrices- the matrices to flatten- Returns:
- the flattened vector
-
toFlattened
INDArray toFlattened(char order, INDArray... matrices)
Flatten all of the ndarrays in to one long vector- Parameters:
matrices- the matrices to flatten- Returns:
- the flattened vector
-
eye
INDArray eye(long n)
Create the identity ndarray- Parameters:
n- the number for the identity- Returns:
-
rot90
void rot90(INDArray toRotate)
Rotate a matrix 90 degrees- Parameters:
toRotate- the matrix to rotate
-
rot
INDArray rot(INDArray reverse)
Reverses the passed in matrix such that m[0] becomes m[m.length - 1] etc- Parameters:
reverse- the matrix to reverse- Returns:
- the reversed matrix
-
reverse
INDArray reverse(INDArray reverse)
Reverses the passed in matrix such that m[0] becomes m[m.length - 1] etc- Parameters:
reverse- the matrix to reverse- Returns:
- the reversed matrix
-
arange
INDArray arange(double begin, double end, double step)
Array of evenly spaced values. Returns a row vector- Parameters:
begin- the begin of the rangeend- the end of the range- Returns:
- the range vector
-
copy
void copy(INDArray a, INDArray b)
Copy a to b- Parameters:
a- the origin matrixb- the destination matrix
-
rand
INDArray rand(int[] shape, float min, float max, Random rng)
Generates a random matrix between min and max- Parameters:
shape- the number of rows of the matrixmin- the minimum numbermax- the maximum numberrng- the rng to use- Returns:
- a drandom matrix of the specified shape and range
-
rand
INDArray rand(long rows, long columns, float min, float max, Random rng)
Generates a random matrix between min and max- Parameters:
rows- the number of rows of the matrixcolumns- the number of columns in the matrixmin- the minimum numbermax- the maximum numberrng- the rng to use- Returns:
- a drandom matrix of the specified shape and range
-
create
INDArray create(double[][] data)
Create an ndarray with the given data layout- Parameters:
data- the data to create the ndarray with- Returns:
- the ndarray with the given data layout
-
create
INDArray create(double[][] data, char ordering)
Create a matrix from the given data and ordering- Parameters:
data-ordering-- Returns:
-
concat
INDArray concat(int dimension, INDArray... toConcat)
Concatneate ndarrays along a dimension- Parameters:
dimension- the dimension to concatneate alongtoConcat- the ndarrays to concateneate- Returns:
- the concatneated ndarrays
-
specialConcat
INDArray specialConcat(int dimension, INDArray... toConcat)
Concatenate ndarrays along a dimension PLEASE NOTE: This method is special for GPU backend, it works on HOST side only.- Parameters:
dimension- the dimension to concatneate alongtoConcat- the ndarrays to concateneate- Returns:
- the concatneated ndarrays
-
pullRows
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- Parameters:
source- source tensorsourceDimension- dimension of source tensorindexes- indexes from source array- Returns:
-
pullRows
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- Parameters:
source- source tensorsourceDimension- dimension of source tensorindexes- indexes from source arrayorder- order for result array- Returns:
-
pullRows
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 in to the destination array- Parameters:
source-destination-sourceDimension-indexes-- Returns:
-
shuffle
void shuffle(INDArray array, Random rnd, int... dimension)
In place shuffle of an ndarray along a specified set of dimensions- Parameters:
array- the ndarray to shuffledimension- the dimension to do the shuffle
-
shuffle
void shuffle(Collection<INDArray> array, Random rnd, int... dimension)
Symmetric in place shuffle of an ndarray along a specified set of dimensions. All arrays should have equal shapes.- Parameters:
array- the ndarray to shuffledimension- the dimension to do the shuffle
-
shuffle
void shuffle(List<INDArray> array, Random rnd, List<int[]> dimensions)
Symmetric in place shuffle of an ndarray along a specified set of dimensions. Each array in list should have it's own dimension at the same index of dimensions array- Parameters:
array- the ndarray to shuffledimensions- the dimensions to do the shuffle
-
average
INDArray average(INDArray target, INDArray[] arrays)
This method averages input arrays, and returns averaged array- Parameters:
arrays-- Returns:
-
average
INDArray average(INDArray[] arrays)
This method averages input arrays, and returns averaged array- Parameters:
arrays-- Returns:
-
average
INDArray average(Collection<INDArray> arrays)
This method averages input arrays, and returns averaged array- Parameters:
arrays-- Returns:
-
accumulate
INDArray accumulate(INDArray target, INDArray... arrays)
This method sums given arrays to target- Parameters:
target-arrays-- Returns:
-
average
INDArray average(INDArray target, Collection<INDArray> arrays)
This method averages input arrays, and returns averaged array- Parameters:
arrays-- Returns:
-
rand
INDArray rand(long rows, long columns, Random r)
Create a random ndarray with the given shape using the given rng- Parameters:
rows- the number of rows in the matrixcolumns- the number of columns in the matrixr- the random generator to use- Returns:
- the random ndarray with the specified shape
-
rand
INDArray rand(long rows, long columns, long seed)
Create a random ndarray with the given shape using the given rng- Parameters:
rows- the number of rows in the matrixcolumns- the columns of the ndarrayseed- the seed to use- Returns:
- the random ndarray with the specified shape
-
rand
INDArray rand(long rows, long columns)
Create a random ndarray with the given shape using the current time as the seed- Parameters:
rows- the number of rows in the matrixcolumns- the number of columns in the matrix- Returns:
- the random ndarray with the specified shape
-
rand
INDArray rand(char order, long rows, long columns)
Create a random (uniform 0-1) NDArray with the specified shape and order- Parameters:
order- Order ('c' or 'f') of the output arrayrows- Number of rows of the output arraycolumns- Number of columns of the output array
-
randn
INDArray randn(long rows, long columns, Random r)
Random normal using the given rng- Parameters:
rows- the number of rows in the matrixcolumns- the number of columns in the matrixr- the random generator to use- Returns:
-
randn
INDArray randn(long rows, long columns)
Random normal (N(0,1)) using the current time stamp as the seed- Parameters:
rows- the number of rows in the matrixcolumns- the number of columns in the matrix- Returns:
-
randn
INDArray randn(char order, long rows, long columns)
Random normal N(0,1), with specified output order- Parameters:
rows- the number of rows in the matrixcolumns- the number of columns in the matrix
-
randn
INDArray randn(long rows, long columns, long seed)
Random normal using the specified seed- Parameters:
rows- the number of rows in the matrixcolumns- the number of columns in the matrix- Returns:
-
rand
INDArray rand(int[] shape, Distribution r)
Create a random ndarray with the given shape using the given rng- Parameters:
shape- the shape of the ndarrayr- the random generator to use- Returns:
- the random ndarray with the specified shape
-
rand
INDArray rand(int[] shape, Random r)
Create a random ndarray with the given shape using the given rng- Parameters:
shape- the shape of the ndarrayr- the random generator to use- Returns:
- the random ndarray with the specified shape
-
rand
INDArray rand(int[] shape, long seed)
Create a random ndarray with the given shape using the given rng- Parameters:
shape- the shape of the ndarrayseed- the seed to use- Returns:
- the random ndarray with the specified shape
-
rand
INDArray rand(long[] shape, long seed)
-
rand
INDArray rand(int[] shape)
Create a random ndarray with the given shape using the current time as the seed- Parameters:
shape- the shape of the ndarray- Returns:
- the random ndarray with the specified shape
-
rand
INDArray rand(long[] shape)
Create a random ndarray with the given shape using the current time as the seed- Parameters:
shape- the shape of the ndarray- Returns:
- the random ndarray with the specified shape
-
rand
INDArray rand(char order, int[] shape)
Create a random ndarray with the given shape, and specified output order- Parameters:
shape- the shape of the ndarray- Returns:
- the random ndarray with the specified shape
-
rand
INDArray rand(char order, long[] shape)
Create a random ndarray with the given shape and specified output order- Parameters:
order- the order of the arrayshape- the shape of the array- Returns:
- the created ndarray
-
randn
INDArray randn(int[] shape, Random r)
Random normal using the given rng- Parameters:
shape- the shape of the ndarrayr- the random generator to use
-
randn
INDArray randn(int[] shape)
Random normal N(0,1) using the current time stamp as the seed- Parameters:
shape- the shape of the ndarray
-
randn
INDArray randn(long[] shape)
Random normal N(0,1) using the current time stamp as the seed- Parameters:
shape- the shape of the ndarray
-
randn
INDArray randn(char order, int[] shape)
Random normal N(0,1) with the specified shape and order- Parameters:
order- the order ('c' or 'f') of the output arrayshape- the shape of the ndarray
-
randn
INDArray randn(char order, long[] shape)
Random normal N(0,1) with the specified shape and order- Parameters:
order- the order ('c' or 'f') of the output arrayshape- the shape of the ndarray
-
randn
INDArray randn(int[] shape, long seed)
Random normal using the specified seed- Parameters:
shape- the shape of the ndarray- Returns:
-
randn
INDArray randn(long[] shape, long seed)
Random normal using the specified seed- Parameters:
shape- the shape of the ndarray- Returns:
-
create
INDArray create(double[] data)
Creates a row vector with the data- Parameters:
data- the columns of the ndarray- Returns:
- the created ndarray
-
create
INDArray create(float[] data)
Creates a row vector with the data- Parameters:
data- the columns of the ndarray- Returns:
- the created ndarray
-
create
INDArray create(DataBuffer data)
Creates a row vector with the data- Parameters:
data- the columns of the ndarray- Returns:
- the created ndarray
-
create
INDArray create(long columns)
Creates a row vector with the specified number of columns- Parameters:
columns- the columns of the ndarray- Returns:
- the created ndarray
-
zeros
INDArray zeros(long rows, long columns)
Creates a row vector with the specified number of columns- Parameters:
rows- the rows of the ndarraycolumns- the columns of the ndarray- Returns:
- the created ndarray
-
zeros
INDArray zeros(long columns)
Creates a row vector with the specified number of columns- Parameters:
columns- the columns of the ndarray- Returns:
- the created ndarray
-
valueArrayOf
INDArray valueArrayOf(int[] shape, double value)
Creates an ndarray with the specified value as the only value in the ndarray- Parameters:
shape- the shape of the ndarrayvalue- the value to assign- Returns:
- the created ndarray
-
valueArrayOf
INDArray valueArrayOf(long[] shape, double value)
-
valueArrayOf
INDArray valueArrayOf(long rows, long columns, double value)
Creates a row vector with the specified number of columns- Parameters:
rows- the number of rows in the matrixcolumns- the columns of the ndarrayvalue- the value to assign- Returns:
- the created ndarray
-
ones
INDArray ones(long rows, long columns)
Creates a row vector with the specified number of columns- Parameters:
rows- the number of rows in the matrixcolumns- the columns of the ndarray- Returns:
- the created ndarray
-
ones
INDArray ones(long columns)
Creates a row vector with the specified number of columns- Parameters:
columns- the columns of the ndarray- Returns:
- the created ndarray
-
hstack
INDArray hstack(INDArray... arrs)
Concatenates two matrices horizontally. Matrices must have identical numbers of rows.- Parameters:
arrs-
-
vstack
INDArray vstack(INDArray... arrs)
Concatenates two matrices vertically. Matrices must have identical numbers of columns.- Parameters:
arrs-
-
zeros
INDArray zeros(int[] shape)
Create an ndarray of zeros- Parameters:
shape- the shape of the ndarray- Returns:
- an ndarray with ones filled in
-
zeros
INDArray zeros(long[] shape)
-
ones
INDArray ones(int[] shape)
Create an ndarray of ones- Parameters:
shape- the shape of the ndarray- Returns:
- an ndarray with ones filled in
-
ones
INDArray ones(long[] shape)
-
create
INDArray create(DataBuffer data, long rows, long columns, int[] stride, long offset)
Creates an ndarray with the specified shape- Parameters:
data- the data to use with the ndarrayrows- the rows of the ndarraycolumns- the columns of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
create
INDArray create(float[] data, long rows, long columns, int[] stride, long offset)
- Parameters:
data-rows-columns-stride-offset-- Returns:
-
create
INDArray create(float[] data, int[] shape, int[] stride, long offset)
Creates an ndarray with the specified shape- Parameters:
shape- the shape of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
create
INDArray create(float[] data, long[] shape, long[] stride, long offset)
-
create
INDArray create(double[] data, int[] shape)
Create an ndrray with the specified shape- Parameters:
data- the data to use with tne ndarrayshape- the shape of the ndarray- Returns:
- the created ndarray
-
create
INDArray create(double[] data, long[] shape)
-
create
INDArray create(float[] data, long[] shape)
-
create
INDArray create(float[] data, int[] shape)
Create an ndrray with the specified shape- Parameters:
data- the data to use with tne ndarrayshape- the shape of the ndarray- Returns:
- the created ndarray
-
create
INDArray create(double[] data, long rows, long columns, int[] stride, long offset)
Creates an ndarray with the specified shape- Parameters:
data- the data to use with tne ndarrayrows- the rows of the ndarraycolumns- the columns of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
create
INDArray create(double[] data, int[] shape, int[] stride, long offset)
Creates an ndarray with the specified shape- Parameters:
shape- the shape of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
create
INDArray create(double[] data, long[] shape, long[] stride, long offset)
-
create
INDArray create(double[] data, long[] shape, long[] stride, DataType dataType, MemoryWorkspace workspace)
-
create
INDArray create(float[] data, long[] shape, long[] stride, DataType dataType, MemoryWorkspace workspace)
-
create
INDArray create(long[] data, long[] shape, long[] stride, DataType dataType, MemoryWorkspace workspace)
-
create
INDArray create(int[] data, long[] shape, long[] stride, DataType dataType, MemoryWorkspace workspace)
-
create
INDArray create(short[] data, long[] shape, long[] stride, DataType dataType, MemoryWorkspace workspace)
-
create
INDArray create(byte[] data, long[] shape, long[] stride, DataType dataType, MemoryWorkspace workspace)
-
create
INDArray create(boolean[] data, long[] shape, long[] stride, DataType dataType, MemoryWorkspace workspace)
-
create
INDArray create(double[] data, long[] shape, long[] stride, char order, DataType dataType, MemoryWorkspace workspace)
-
create
INDArray create(float[] data, long[] shape, long[] stride, char order, DataType dataType, MemoryWorkspace workspace)
-
create
INDArray create(long[] data, long[] shape, long[] stride, char order, DataType dataType, MemoryWorkspace workspace)
-
create
INDArray create(int[] data, long[] shape, long[] stride, char order, DataType dataType, MemoryWorkspace workspace)
-
create
INDArray create(short[] data, long[] shape, long[] stride, char order, DataType dataType, MemoryWorkspace workspace)
-
create
INDArray create(byte[] data, long[] shape, long[] stride, char order, DataType dataType, MemoryWorkspace workspace)
-
create
INDArray create(boolean[] data, long[] shape, long[] stride, char order, DataType dataType, MemoryWorkspace workspace)
-
create
INDArray create(DataBuffer data, int[] shape)
Create an ndrray with the specified shape- Parameters:
data- the data to use with tne ndarrayshape- the shape of the ndarray- Returns:
- the created ndarray
-
create
INDArray create(DataBuffer data, long[] shape)
-
create
INDArray create(DataBuffer data, int[] shape, int[] stride, long offset)
Creates an ndarray with the specified shape- Parameters:
shape- the shape of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
create
INDArray create(DataBuffer data, long[] shape, long[] stride, long offset)
-
create
INDArray create(List<INDArray> list, int[] shape)
Creates an ndarray with the specified shape- Parameters:
shape- the shape of the ndarray- Returns:
- the instance
-
create
INDArray create(long rows, long columns, int[] stride, long offset)
Creates an ndarray with the specified shape- Parameters:
rows- the rows of the ndarraycolumns- the columns of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
create
INDArray create(long rows, long columns, long[] stride, long offset)
-
create
INDArray create(int[] shape, int[] stride, long offset)
Creates an ndarray with the specified shape- Parameters:
shape- the shape of the ndarraystride- the stride for the ndarrayoffset- the offset of the ndarray- Returns:
- the instance
-
create
INDArray create(long[] shape, long[] stride, long offset)
-
create
INDArray create(long rows, long columns, int[] stride)
Creates an ndarray with the specified shape- Parameters:
rows- the rows of the ndarraycolumns- the columns of the ndarraystride- the stride for the ndarray- Returns:
- the instance
-
create
INDArray create(int[] shape, int[] stride)
Creates an ndarray with the specified shape- Parameters:
shape- the shape of the ndarraystride- the stride for the ndarray- Returns:
- the instance
-
create
INDArray create(long[] shape, long[] stride)
-
create
INDArray create(long[] shape)
-
create
INDArray create(long rows, long columns)
Creates an ndarray with the specified shape- Parameters:
rows- the rows of the ndarraycolumns- the columns of the ndarray- Returns:
- the instance
-
create
INDArray create(int[] shape)
Creates an ndarray with the specified shape- Parameters:
shape- the shape of the ndarray- Returns:
- the instance
-
scalar
INDArray scalar(float value, long offset)
Create a scalar nd array with the specified value and offset- Parameters:
value- the value of the scalaroffset- the offset of the ndarray- Returns:
- the scalar nd array
-
scalar
INDArray scalar(double value, long offset)
Create a scalar nd array with the specified value and offset- Parameters:
value- the value of the scalaroffset- the offset of the ndarray- Returns:
- the scalar nd array
-
scalar
INDArray scalar(int value, long offset)
-
scalar
INDArray scalar(Number value)
Create a scalar ndarray with the specified offset- Parameters:
value- the value to initialize the scalar with- Returns:
- the created ndarray
-
scalar
INDArray scalar(float value)
Create a scalar nd array with the specified value and offset- Parameters:
value- the value of the scalar = * @return the scalar nd array
-
scalar
INDArray scalar(double value)
Create a scalar nd array with the specified value and offset- Parameters:
value- the value of the scalar = * @return the scalar nd array
-
scalar
INDArray scalar(DataType dataType)
Create a scalar nd array with the data type and a default value depending on the data type. Generally this will be an empty string for UTF8 or 0.0 for numerical values, or true for booleans.- Parameters:
dataType- the dataType of the scalar * @return the scalar nd array
-
create
INDArray create(float[] data, int[] shape, long offset)
- Parameters:
data-shape-offset-- Returns:
-
create
INDArray create(float[] data, int[] shape, char ordering)
- Parameters:
data-shape-ordering-- Returns:
-
create
INDArray create(float[][] floats)
- Parameters:
floats-- Returns:
-
create
INDArray create(float[][] data, char ordering)
-
create
INDArray create(float[] data, int[] shape, int[] stride, long offset, char ordering)
- Parameters:
data-shape-stride-offset-ordering-- Returns:
-
create
INDArray create(DataBuffer buffer, int[] shape, long offset)
- Parameters:
buffer-shape-offset-- Returns:
-
create
INDArray create(int[] shape, char ordering)
- Parameters:
shape-ordering-- Returns:
-
create
INDArray create(long[] shape, char ordering)
-
create
INDArray create(DataType dataType, long[] shape, char ordering, MemoryWorkspace workspace)
-
create
INDArray create(DataType dataType, long[] shape, long[] strides, char ordering, MemoryWorkspace workspace)
-
create
INDArray create(DataType dataType, long[] shape, long[] paddings, long[] paddingOffsets, char ordering, MemoryWorkspace workspace)
Create an ndArray with padded Buffer- Parameters:
dataType-shape-paddings-paddingOffsets-ordering- Fortran 'f' or C/C++ 'c' ordering.workspace-- Returns:
-
createUninitialized
INDArray createUninitialized(int[] shape, char ordering)
-
createUninitialized
INDArray createUninitialized(long[] shape, char ordering)
-
createUninitialized
INDArray createUninitialized(DataType dataType, long[] shape, char ordering, MemoryWorkspace workspace)
-
createUninitializedDetached
INDArray createUninitializedDetached(DataType dataType, char ordering, long... shape)
Create an uninitialized ndArray. Detached from workspace.- Parameters:
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.- Returns:
- the created detached array.
-
create
INDArray create(DataBuffer data, int[] newShape, int[] newStride, long offset, char ordering)
- Parameters:
data-newShape-newStride-offset-ordering-- Returns:
-
create
INDArray create(DataBuffer data, long[] newShape, long[] newStride, long offset, char ordering)
-
create
INDArray create(DataBuffer data, long[] newShape, long[] newStride, long offset, long ews, char ordering)
-
create
INDArray create(DataBuffer data, long[] newShape, long[] newStride, long offset, char ordering, DataType dataType)
-
rand
INDArray rand(long rows, long columns, double min, double max, Random rng)
- Parameters:
rows-columns-min-max-rng-- Returns:
-
create
INDArray create(float[] data, int[] shape, long offset, Character order)
- Parameters:
data-shape-offset-order-- Returns:
-
create
INDArray create(float[] data, long rows, long columns, int[] stride, long offset, char ordering)
- Parameters:
data-rows-columns-stride-offset-ordering-- Returns:
-
create
INDArray create(double[] data, int[] shape, char ordering)
- Parameters:
data-shape-ordering-- Returns:
-
create
INDArray create(List<INDArray> list, int[] shape, char ordering)
- Parameters:
list-shape-ordering-- Returns:
-
create
INDArray create(double[] data, int[] shape, long offset)
- Parameters:
data-shape-offset-- Returns:
-
create
INDArray create(double[] data, int[] shape, int[] stride, long offset, char ordering)
- Parameters:
data-shape-stride-offset-ordering-- Returns:
-
rand
INDArray rand(int[] shape, double min, double max, Random rng)
- Parameters:
shape-min-max-rng-- Returns:
-
create
INDArray create(int[] ints, int[] ints1, int[] stride, long offset)
- Parameters:
ints-ints1-stride-offset-- Returns:
-
create
INDArray create(int[] shape, int[] ints1, int[] stride, char order, long offset)
- Parameters:
shape-ints1-stride-order-offset-- Returns:
-
create
INDArray create(long rows, long columns, char ordering)
- Parameters:
rows-columns-ordering-- Returns:
-
create
INDArray create(int[] shape, DataType dataType, MemoryWorkspace workspace)
- Parameters:
shape-dataType-- Returns:
-
create
INDArray create(float[] data, char order)
- Parameters:
data-order-- Returns:
-
create
INDArray create(float[] data, int[] shape, int[] stride, char order, long offset)
- Parameters:
data-shape-stride-order-offset-- Returns:
-
create
INDArray create(float[] data, long[] shape, long[] stride, char order, long offset)
-
create
INDArray create(DataBuffer buffer, int[] shape, int[] stride, char order, long offset)
- Parameters:
buffer-shape-stride-order-offset-- Returns:
-
create
INDArray create(double[] data, char order)
- Parameters:
data-order-- Returns:
-
create
INDArray create(double[] data, int[] shape, int[] stride, char order, long offset)
- Parameters:
data-shape-stride-order-offset-- Returns:
-
create
INDArray create(int[] shape, int[] stride, long offset, char ordering)
- Parameters:
shape-stride-offset-ordering-- Returns:
-
create
INDArray create(long[] shape, long[] stride, long offset, char ordering)
-
convertDataEx
INDArray convertDataEx(DataTypeEx typeSrc, INDArray source, DataTypeEx typeDst)
- Parameters:
typeSrc-source-typeDst-- Returns:
-
convertDataEx
DataBuffer convertDataEx(DataTypeEx typeSrc, DataBuffer source, DataTypeEx typeDst)
- Parameters:
typeSrc-source-typeDst-- Returns:
-
convertDataEx
void convertDataEx(DataTypeEx typeSrc, DataBuffer source, DataTypeEx typeDst, DataBuffer target)
- Parameters:
typeSrc-source-typeDst-target-
-
convertDataEx
void convertDataEx(DataTypeEx typeSrc, org.bytedeco.javacpp.Pointer source, DataTypeEx typeDst, org.bytedeco.javacpp.Pointer target, long length)
- Parameters:
typeSrc-source-typeDst-target-length-
-
convertDataEx
void convertDataEx(DataTypeEx typeSrc, org.bytedeco.javacpp.Pointer source, DataTypeEx typeDst, DataBuffer buffer)
- Parameters:
typeSrc-source-typeDst-buffer-
-
createFromNpyPointer
INDArray createFromNpyPointer(org.bytedeco.javacpp.Pointer pointer)
Create from an in memory numpy pointer- Parameters:
pointer- the pointer to the numpy array- Returns:
- an ndarray created from the in memory numpy pointer
-
createFromNpyHeaderPointer
INDArray createFromNpyHeaderPointer(org.bytedeco.javacpp.Pointer pointer)
Create from an in memory numpy header. Use this when not interopping directly from python.- Parameters:
pointer- the pointer to the numpy header- Returns:
- an ndarray created from the in memory numpy pointer
-
createFromNpyFile
INDArray createFromNpyFile(File file)
Create from a given numpy file.- Parameters:
file- the file to create the ndarray from- Returns:
- the created ndarray
-
createFromNpzFile
Map<String,INDArray> createFromNpzFile(File file) throws Exception
Create a Mapfrom given npz file. - Parameters:
file- the file to create the map from- Returns:
- Map
- Throws:
Exception
-
convertToNumpy
org.bytedeco.javacpp.Pointer convertToNumpy(INDArray array)
Convert anINDArrayto a numpy array. This will usually be used for writing out to an external source. Note that this will create a zero copy reference to this ndarray's underlying data.- Parameters:
array- the array to convert
-
create
INDArray create(float[] data, long[] shape, long[] stride, long offset, char ordering)
-
create
INDArray create(double[] data, long[] shape, long[] stride, long offset, char ordering)
-
tear
INDArray[] tear(INDArray tensor, int... dimensions)
- Parameters:
tensor-dimensions-- Returns:
-
create
INDArray create(float[] data, long[] shape, char ordering)
-
create
INDArray create(double[] data, long[] shape, char ordering)
-
create
INDArray create(Collection<String> strings, long[] shape, char order)
-
-