INDArray javadoc (#246)
* javadoc Signed-off-by: Robert Altena <Rob@Ra-ai.com> * javadoc Signed-off-by: Robert Altena <Rob@Ra-ai.com> * javadoc Signed-off-by: Robert Altena <Rob@Ra-ai.com> * review fixes. Signed-off-by: Robert Altena <Rob@Ra-ai.com>master
parent
46f8c58502
commit
c99f980513
|
@ -1724,12 +1724,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the elements at the specified indices
|
||||
*
|
||||
* @param indices the indices to getScalar
|
||||
* @return the array with the specified elements
|
||||
*/
|
||||
@Override
|
||||
public int getInt(int... indices) {
|
||||
return (int) getDouble(indices);
|
||||
|
@ -1761,12 +1755,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return Shape.getLong(this, indices);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the elements at the specified indices
|
||||
*
|
||||
* @param indices the indices to get
|
||||
* @return the array with the specified elements
|
||||
*/
|
||||
@Override
|
||||
public double getDouble(int... indices) {
|
||||
autoProcessScalarCall();
|
||||
|
@ -1815,12 +1803,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return Shape.getDouble(this, indices);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the elements at the specified indices
|
||||
*
|
||||
* @param indices the indices to get
|
||||
* @return the array with the specified elements
|
||||
*/
|
||||
@Override
|
||||
public float getFloat(int... indices) {
|
||||
return (float) getDouble(indices);
|
||||
|
@ -1831,9 +1813,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return (float) getDouble(indices);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test whether a matrix is scalar.
|
||||
*/
|
||||
@Override
|
||||
public boolean isScalar() {
|
||||
if (isEmpty())
|
||||
|
@ -2000,11 +1979,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this ndarray is 2d
|
||||
*
|
||||
* @return true if the element is a matrix, false otherwise
|
||||
*/
|
||||
public boolean isMatrix() {
|
||||
return rank() == 2;
|
||||
}
|
||||
|
@ -2216,14 +2190,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mainly here for people coming from numpy.
|
||||
* This is equivalent to a call to permute
|
||||
*
|
||||
* @param dimension the dimension to swap
|
||||
* @param with the one to swap it with
|
||||
* @return the swapped axes view
|
||||
*/
|
||||
@Override
|
||||
public INDArray swapAxes(int dimension, int with) {
|
||||
int[] shape = ArrayUtil.range(0, shape().length);
|
||||
|
@ -2263,12 +2229,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of slices: aka shape[0]
|
||||
*
|
||||
* @return the number of slices
|
||||
* for this nd array
|
||||
*/
|
||||
@Override
|
||||
public long slices() {
|
||||
return size(0);
|
||||
|
@ -3377,18 +3337,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return Shape.offset(jvmShapeInfo.javaShapeInformation) + (idx);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the specified slice of this matrix.
|
||||
* In matlab, this would be equivalent to (given a 2 x 2 x 2):
|
||||
* A(:,:,x) where x is the slice you want to return.
|
||||
* <p/>
|
||||
* The slice is always relative to the final dimension of the matrix.
|
||||
*
|
||||
* @param slice the slice to return
|
||||
* @return the specified slice of this matrix
|
||||
*/
|
||||
@Override
|
||||
public INDArray slice(long slice) {
|
||||
Nd4j.getCompressor().autoDecompress(this);
|
||||
|
@ -3425,8 +3373,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return Nd4j.scalar(d);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getTrailingOnes() {
|
||||
int numLeadingOnes = 0;
|
||||
|
@ -3438,8 +3384,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return numLeadingOnes;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getLeadingOnes() {
|
||||
int numLeadingOnes = 0;
|
||||
|
@ -3451,16 +3395,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return numLeadingOnes;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the slice of this from the specified dimension
|
||||
*
|
||||
* @param slice the dimension to return from
|
||||
* @param dimension the dimension of the slice to return
|
||||
* @return the slice of this matrix from the specified dimension
|
||||
* and dimension
|
||||
*/
|
||||
@Override
|
||||
public INDArray slice(long slice, int dimension) {
|
||||
Nd4j.getCompressor().autoDecompress(this);
|
||||
|
@ -3490,12 +3424,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a particular number on a multi dimensional scale.
|
||||
*
|
||||
* @param indexes the indexes to get a number from
|
||||
* @return the number at the specified indices
|
||||
*/
|
||||
@Override
|
||||
public INDArray getScalar(int[] indexes) {
|
||||
if (indexes.length > rank())
|
||||
|
@ -3717,9 +3645,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return (float) getDouble(i, j);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return transposed copy of this matrix.
|
||||
*/
|
||||
@Override
|
||||
public INDArray transpose() {
|
||||
Preconditions.checkState(rank() >= 2, "Can't transpose array with rank < 2: array shape %ndShape", this);
|
||||
|
@ -3727,7 +3652,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return permute(ArrayUtil.reverseCopy(ArrayUtil.range(0, rank())));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Return transposed version of this matrix.
|
||||
|
@ -4047,12 +3971,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return norm2(false, dimension);
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of columns (shape[1]), throws an exception when
|
||||
* called when not 2d
|
||||
*
|
||||
* @return the number of columns in the array (only 2d)
|
||||
*/
|
||||
@Override
|
||||
public int columns() {
|
||||
// FIXME: int cast
|
||||
|
@ -4068,13 +3986,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of rows
|
||||
* in the array (only 2d) throws an exception when
|
||||
* called when not 2d
|
||||
*
|
||||
* @return the number of rows in the matrix
|
||||
*/
|
||||
@Override
|
||||
public int rows() {
|
||||
// FIXME:
|
||||
|
@ -4089,12 +4000,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
throw new IllegalStateException("Rank is " + rank() + " rows() call is not valid");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Flattens the array for linear indexing
|
||||
*
|
||||
* @return the flattened version of this array
|
||||
*/
|
||||
@Override
|
||||
public INDArray ravel(char ordering) {
|
||||
Nd4j.getCompressor().autoDecompress(this);
|
||||
|
@ -4104,11 +4009,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return dup(ordering).reshape(ordering, length());
|
||||
}
|
||||
|
||||
/**
|
||||
* Flattens the array for linear indexing
|
||||
*
|
||||
* @return the flattened version of this array
|
||||
*/
|
||||
@Override
|
||||
public INDArray ravel() {
|
||||
return reshape(length());
|
||||
|
@ -4125,22 +4025,11 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reshape the matrix. Number of elements must not change.
|
||||
*
|
||||
* @param newRows
|
||||
* @param newColumns
|
||||
*/
|
||||
@Override
|
||||
public INDArray reshape(long newRows, long newColumns) {
|
||||
return reshape(new long[] {newRows, newColumns});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the specified column
|
||||
*
|
||||
* @param c
|
||||
*/
|
||||
@Override
|
||||
public INDArray getColumn(long c) {
|
||||
Nd4j.getCompressor().autoDecompress(this);
|
||||
|
@ -4383,11 +4272,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return create(new int[] {rows, length});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a copy of a row.
|
||||
*
|
||||
* @param r the row to get
|
||||
*/
|
||||
@Override
|
||||
public INDArray getRow(long r) {
|
||||
if (isRowVector() && r == 0)
|
||||
|
@ -4409,14 +4293,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return row.reshape(1, row.length());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method allows you to compare INDArray against other INDArray, with variable eps
|
||||
*
|
||||
* @param o
|
||||
* @param eps
|
||||
* @return
|
||||
*/
|
||||
public boolean equalsWithEps(Object o, double eps) {
|
||||
Nd4j.getCompressor().autoDecompress(this);
|
||||
|
||||
|
@ -4563,11 +4439,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return shapeInformation.asNioLong();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shape(dimensions) of this array
|
||||
*
|
||||
* @return the shape of this matrix
|
||||
*/
|
||||
public long[] shape() {
|
||||
return jvmShapeInfo.shape;
|
||||
}
|
||||
|
@ -4577,11 +4448,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return Shape.shapeToString(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the stride(indices along the linear index for which each slice is accessed) of this array
|
||||
*
|
||||
* @return the stride of this array
|
||||
*/
|
||||
@Override
|
||||
public long[] stride() {
|
||||
return jvmShapeInfo.stride;
|
||||
|
@ -4598,13 +4464,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return jvmShapeInfo.order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of this array
|
||||
* along a particular dimension
|
||||
*
|
||||
* @param dimension the dimension to return from
|
||||
* @return the shape of the specified dimension
|
||||
*/
|
||||
@Override
|
||||
public long size(int dimension) {
|
||||
if (dimension < 0)
|
||||
|
@ -4629,11 +4488,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return jvmShapeInfo.rank;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the total number of elements in the ndarray
|
||||
*
|
||||
* @return the number of elements in the ndarray
|
||||
*/
|
||||
@Override
|
||||
public long length() {
|
||||
if (isEmpty())
|
||||
|
@ -4745,12 +4599,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts this ndarray to be the specified shape
|
||||
*
|
||||
* @param shape the new shape of this ndarray
|
||||
* @return the broadcasted ndarray
|
||||
*/
|
||||
@Override
|
||||
public INDArray broadcast(long... shape) {
|
||||
return broadcast(Nd4j.createUninitialized(this.dataType(), shape, this.ordering()));
|
||||
|
@ -4877,12 +4725,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* See: http://www.mathworks.com/help/matlab/ref/permute.html
|
||||
*
|
||||
* @param rearrange the dimensions to swap to
|
||||
* @return the newly permuted array
|
||||
*/
|
||||
@Override
|
||||
public INDArray permute(int... rearrange) {
|
||||
Preconditions.checkArgument(rearrange.length == rank(), "Incorrect number of arguments for permute function:" +
|
||||
|
@ -4911,14 +4753,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* An <b>in-place</b> version of permute. The array shape information (shape, strides)
|
||||
* is modified by this operation (but not the data itself)
|
||||
* See: http://www.mathworks.com/help/matlab/ref/permute.html
|
||||
*
|
||||
* @param rearrange the dimensions to swap to
|
||||
* @return the current array
|
||||
*/
|
||||
@Override
|
||||
public INDArray permutei(int... rearrange) {
|
||||
Preconditions.checkArgument(rearrange.length == rank(), "Incorrect number of arguments for permute function:" +
|
||||
|
@ -5047,17 +4881,11 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return isMatrix() && rows() == columns();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the matrix is a row vector.
|
||||
*/
|
||||
@Override
|
||||
public boolean isRowVector() {
|
||||
return (rank() == 2 && rows() == 1) && length() > 1 || rank() == 1 && length() > 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the matrix is a column vector.
|
||||
*/
|
||||
@Override
|
||||
public boolean isColumnVector() {
|
||||
return rank() == 2 && columns() == 1 && length() > 1;
|
||||
|
@ -5112,12 +4940,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return toString(Long.MAX_VALUE, false, -1 * dataType().precision());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a scalar (individual element)
|
||||
* of a scalar ndarray
|
||||
*
|
||||
* @return the individual item in this ndarray
|
||||
*/
|
||||
@Override
|
||||
public Object element() {
|
||||
|
||||
|
@ -5236,11 +5058,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return new FirstAxisIterator(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the start of where the ndarray is for the original data buffer
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public long originalOffset() {
|
||||
if (data().originalOffset() >= Integer.MAX_VALUE)
|
||||
|
@ -5294,24 +5111,11 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
data().read(s, headerData.getLeft(), headerData.getMiddle(), headerData.getRight());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method returns index of highest value along specified dimension(s)
|
||||
*
|
||||
* @param dimension
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public INDArray argMax(int... dimension) {
|
||||
return Nd4j.argMax(this, dimension);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method returns True, if this INDArray instance is attached to some Workspace. False otherwise.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isAttached() {
|
||||
if (isEmpty())
|
||||
|
@ -5324,13 +5128,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
(data.originalDataBuffer() != null && data.originalDataBuffer().isAttached());
|
||||
}
|
||||
|
||||
/**
|
||||
* This method checks, if given attached INDArray is still in scope of its parent Workspace
|
||||
* <p>
|
||||
* PLEASE NOTE: if this INDArray isn't attached to any Workspace, this method will return true
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isInScope() {
|
||||
if (!isAttached())
|
||||
|
@ -5339,13 +5136,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return data.isInScope();
|
||||
}
|
||||
|
||||
/**
|
||||
* This metod detaches INDArray from Workspace, returning copy. Basically it's dup() into new memory chunk.
|
||||
* <p>
|
||||
* PLEASE NOTE: If this INDArray instance is NOT attached - it will be returned unmodified.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public INDArray detach() {
|
||||
if (!isAttached())
|
||||
|
@ -5402,14 +5192,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method detaches INDArray from current Workspace, and attaches it to Workspace above, if any.
|
||||
* <p>
|
||||
* PLEASE NOTE: If this INDArray instance is NOT attached - it will be returned unmodified.
|
||||
* PLEASE NOTE: If current Workspace is the top-tier one, effect will be equal to detach() call - detached copy will be returned
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public INDArray leverage() {
|
||||
WorkspaceUtils.assertValidArray(this, "Cannot leverage INDArray to new workspace");
|
||||
|
@ -5453,33 +5235,11 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method detaches INDArray from current Workspace, and attaches it to Workspace with a given Id
|
||||
*
|
||||
* PLEASE NOTE: If this INDArray instance is NOT attached - it will be returned unmodified.
|
||||
* PLEASE NOTE: If Workspace with target Id wasn't created before - this array will be returned unmodified.
|
||||
* PLEASE NOTE: If target workspace is the current one - this array will be returned unmodified.
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public INDArray leverageTo(String id) {
|
||||
return leverageTo(id, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method detaches INDArray from current Workspace, and attaches it to Workspace with a given Id.
|
||||
* If enforceExistence == true, and no workspace with the specified ID exists, then an {@link Nd4jNoSuchWorkspaceException}
|
||||
* is thrown. Otherwise, if enforceExistance == false and no workspace with the specified ID exists, then the current
|
||||
* INDArray is returned unmodified (same as {@link #leverage()}
|
||||
*
|
||||
* @param id ID of the workspace to leverage to
|
||||
* @param enforceExistence If true, and the specified workspace does not exist: an {@link Nd4jNoSuchWorkspaceException}
|
||||
* will be thrown.
|
||||
* @return The INDArray, leveraged to the specified workspace
|
||||
* @see #leverageTo(String)
|
||||
*/
|
||||
@Override
|
||||
public INDArray leverageTo(String id, boolean enforceExistence) throws Nd4jNoSuchWorkspaceException {
|
||||
WorkspaceUtils.assertValidArray(this, "Cannot leverage INDArray to new workspace");
|
||||
|
@ -5518,16 +5278,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method detaches INDArray from current Workspace, and attaches it to Workspace with a given Id, if a workspace
|
||||
* with the given ID is open and active.
|
||||
*
|
||||
* If the workspace does not exist, or is not active, the array is detached from any workspaces.
|
||||
*
|
||||
* @param id ID of the workspace to leverage to
|
||||
* @return The INDArray, leveraged to the specified workspace (if it exists and is active) otherwise the detached array
|
||||
* @see #leverageTo(String)
|
||||
*/
|
||||
public INDArray leverageOrDetach(String id){
|
||||
if(!isAttached()){
|
||||
return this;
|
||||
|
@ -5539,30 +5289,11 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return leverageTo(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method pulls this INDArray into current Workspace.
|
||||
*
|
||||
* PLEASE NOTE: If there's no current Workspace - INDArray returned as is
|
||||
*
|
||||
* @return Migrated INDArray or <i>this</i> if no current workspace
|
||||
* @see #migrate(boolean)
|
||||
*/
|
||||
@Override
|
||||
public INDArray migrate() {
|
||||
return migrate(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method pulls this INDArray into current Workspace, or optionally detaches if no workspace is present.<br>
|
||||
* That is:<br>
|
||||
* If current workspace is present/active, INDArray is migrated to it.<br>
|
||||
* If no current workspace is present/active, one of two things occur:
|
||||
* 1. If detachOnNoWs arg is true: if there is no current workspace, INDArray is detached
|
||||
* 2. If detachOnNoWs arg is false: this INDArray is returned as-is (no-op) - equivalent to {@link #migrate()}
|
||||
*
|
||||
* @param detachOnNoWs If true: detach on no WS. If false and no workspace: return this.
|
||||
* @return Migrated INDArray
|
||||
*/
|
||||
@Override
|
||||
public INDArray migrate(boolean detachOnNoWs){
|
||||
WorkspaceUtils.assertValidArray(this, "Cannot leverage INDArray to new workspace");
|
||||
|
@ -5778,17 +5509,11 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
throw new IllegalStateException("Unknown dataType: [" + type + "]");
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns true if this INDArray is special case: no-value INDArray
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return Shape.isEmpty(jvmShapeInfo.javaShapeInformation);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long[] shapeInfoJava() {
|
||||
return jvmShapeInfo.javaShapeInformation;
|
||||
|
@ -5880,8 +5605,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
throw new IllegalStateException("Cannot perform operation " + opName + " on empty array with datatype " + dataType());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean closeable() {
|
||||
if (released || isAttached())
|
||||
|
|
|
@ -1296,7 +1296,7 @@ public abstract class BaseSparseNDArray implements ISparseNDArray {
|
|||
}
|
||||
|
||||
@Override
|
||||
public float getFloat(long[] indices) {
|
||||
public float getFloat(long... indices) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1321,7 +1321,7 @@ public abstract class BaseSparseNDArray implements ISparseNDArray {
|
|||
}
|
||||
|
||||
@Override
|
||||
public float getFloat(int[] indices) {
|
||||
public float getFloat(int... indices) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1514,23 +1514,16 @@ public abstract class BaseSparseNDArray implements ISparseNDArray {
|
|||
return isMatrix() && rows() == columns();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the matrix is a row vector.
|
||||
*/
|
||||
@Override
|
||||
public boolean isRowVector() {
|
||||
return rank == 2 && rows == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the matrix is a column vector.
|
||||
*/
|
||||
@Override
|
||||
public boolean isColumnVector() {
|
||||
return rank == 2 && columns == 1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isMatrix() {
|
||||
if (isMatrix != null)
|
||||
|
|
|
@ -683,12 +683,12 @@ public class BaseSparseNDArrayCOO extends BaseSparseNDArray {
|
|||
}
|
||||
|
||||
@Override
|
||||
public float getFloat(int[] indices) {
|
||||
public float getFloat(int... indices) {
|
||||
return (float) getDouble(indices);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloat(long[] indices) {
|
||||
public float getFloat(long... indices) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -860,11 +860,6 @@ public class BaseSparseNDArrayCOO extends BaseSparseNDArray {
|
|||
return Nd4j.createBuffer(Doubles.toArray(val));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the indices of non-zero element of the vector
|
||||
*
|
||||
* @return indices in Databuffer
|
||||
* */
|
||||
@Override
|
||||
public DataBuffer getVectorCoordinates() {
|
||||
int idx;
|
||||
|
@ -884,10 +879,6 @@ public class BaseSparseNDArrayCOO extends BaseSparseNDArray {
|
|||
return Nd4j.createBuffer(temp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the sparse ndarray into a dense one
|
||||
* @return a dense ndarray
|
||||
*/
|
||||
@Override
|
||||
public INDArray toDense() {
|
||||
// TODO support view conversion
|
||||
|
@ -1131,11 +1122,6 @@ public class BaseSparseNDArrayCOO extends BaseSparseNDArray {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns true if this INDArray is special case: no-value INDArray
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
|
|
|
@ -1912,6 +1912,9 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
*/
|
||||
INDArray getScalar(int... indices);
|
||||
|
||||
/**
|
||||
* See {@link #getScalar(int[])}
|
||||
*/
|
||||
INDArray getScalar(long... indices);
|
||||
|
||||
/**
|
||||
|
@ -1921,12 +1924,32 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
*/
|
||||
int getInt(int... indices);
|
||||
|
||||
/**
|
||||
* Get a long value at the specified index.
|
||||
* @param index Index to get the integer at.
|
||||
* @return long value at the specified index
|
||||
*/
|
||||
long getLong(long index);
|
||||
|
||||
/**
|
||||
* Get a long value at the specified indices.
|
||||
* @param indices Indices to get the double at. Number of indices must match the array rank.
|
||||
* @return long value at the specified index
|
||||
*/
|
||||
long getLong(long... indices);
|
||||
|
||||
/**
|
||||
* Get the numeric value at the specified index.
|
||||
* @param index index to retreive.
|
||||
* @return numeric value at the specified index.
|
||||
*/
|
||||
Number getNumber(long index);
|
||||
|
||||
/**
|
||||
* Get a numeric value at the specified indices.
|
||||
* @param indices Indices to get the value from. Number of indices must match the array rank.
|
||||
* @return Numeric value at the specified index
|
||||
*/
|
||||
Number getNumber(long... indices);
|
||||
|
||||
/**
|
||||
|
@ -1936,6 +1959,9 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
*/
|
||||
double getDouble(int... indices);
|
||||
|
||||
/**
|
||||
* See {@link #getDouble(int[])}
|
||||
*/
|
||||
double getDouble(long... indices);
|
||||
|
||||
/**
|
||||
|
@ -1944,10 +1970,12 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
* @param indices the indices to getScalar
|
||||
* @return the array with the specified elements
|
||||
*/
|
||||
float getFloat(int[] indices);
|
||||
|
||||
float getFloat(long[] indices);
|
||||
float getFloat(int... indices);
|
||||
|
||||
/**
|
||||
* See {@link #getFloat(int...)}
|
||||
*/
|
||||
float getFloat(long... indices);
|
||||
|
||||
/**
|
||||
* Get the double value at the specified linear index in the array
|
||||
|
@ -1962,7 +1990,7 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
*
|
||||
* @param i Dimension 0 (row) index
|
||||
* @param j Dimension 1 (column) index
|
||||
* @return
|
||||
* @return double value at the specified indices
|
||||
*/
|
||||
double getDouble(long i, long j);
|
||||
|
||||
|
@ -1984,7 +2012,6 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
*/
|
||||
float getFloat(long i, long j);
|
||||
|
||||
|
||||
/**
|
||||
* Returns a copy of this ndarray
|
||||
*
|
||||
|
@ -2007,7 +2034,6 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
*/
|
||||
INDArray ravel();
|
||||
|
||||
|
||||
/**
|
||||
* Returns a flattened version (row vector) of this ndarray
|
||||
*
|
||||
|
@ -2015,10 +2041,9 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
*/
|
||||
INDArray ravel(char order);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param data
|
||||
* Set the data for this ndarray.
|
||||
* @param data new value for the ndarray data.
|
||||
*/
|
||||
void setData(DataBuffer data);
|
||||
|
||||
|
@ -2046,15 +2071,15 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
int getLeadingOnes();
|
||||
|
||||
/**
|
||||
* Returns the specified slice of this ndarray
|
||||
* Returns the slice of this from the specified dimension
|
||||
*
|
||||
* @param i the index of the slice to return
|
||||
* @param dimension the dimension to return the slice for
|
||||
* @return the specified slice of this ndarray
|
||||
* @param dimension the dimension of the slice to return
|
||||
* @return the slice of this matrix from the specified dimension
|
||||
* and dimension
|
||||
*/
|
||||
INDArray slice(long i, int dimension);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the specified slice of this ndarray
|
||||
*
|
||||
|
@ -2063,23 +2088,21 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
*/
|
||||
INDArray slice(long i);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the start of where the ndarray is
|
||||
* for the underlying data
|
||||
* Returns the start of where the ndarray is for the underlying data
|
||||
*
|
||||
* @return the starting offset
|
||||
*/
|
||||
long offset();
|
||||
|
||||
|
||||
// TODO: Unused untested method.
|
||||
/**
|
||||
* Returns the start of where the ndarray is for the original data buffer
|
||||
* @return
|
||||
*
|
||||
* @return original offset.
|
||||
*/
|
||||
long originalOffset();
|
||||
|
||||
|
||||
/**
|
||||
* Reshapes the ndarray (can't change the length of the ndarray). Typically this will be a view, unless reshaping
|
||||
* without copying is impossible.
|
||||
|
@ -2110,7 +2133,6 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
*/
|
||||
INDArray reshape(char order, boolean enforceView, long... newShape);
|
||||
|
||||
|
||||
/**
|
||||
* Reshapes the ndarray (can't change the length of the ndarray). Typically this will be a view, unless reshaping
|
||||
* without copying is impossible.
|
||||
|
@ -2121,7 +2143,6 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
*/
|
||||
INDArray reshape(char order, int rows, int columns);
|
||||
|
||||
|
||||
/**
|
||||
* Reshapes the ndarray (can't change the length of the ndarray). Typically this will be a view, unless reshaping
|
||||
* without copying is impossible.
|
||||
|
@ -2131,6 +2152,9 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
*/
|
||||
INDArray reshape(long... newShape);
|
||||
|
||||
/**
|
||||
* See {@link #reshape(long[])}
|
||||
*/
|
||||
INDArray reshape(int[] shape);
|
||||
|
||||
/**
|
||||
|
@ -2150,7 +2174,6 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
*/
|
||||
INDArray transpose();
|
||||
|
||||
|
||||
/**
|
||||
* Flip the rows and columns of a matrix, in-place
|
||||
*
|
||||
|
@ -2216,8 +2239,11 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
* @return the newly permuted array
|
||||
*/
|
||||
INDArray dimShuffle(Object[] rearrange, int[] newOrder, boolean[] broadCastable);
|
||||
INDArray dimShuffle(Object[] rearrange, long[] newOrder, boolean[] broadCastable);
|
||||
|
||||
/**
|
||||
* See {@link #dimShuffle(Object[], int[], boolean[])
|
||||
*/
|
||||
INDArray dimShuffle(Object[] rearrange, long[] newOrder, boolean[] broadCastable);
|
||||
|
||||
/**
|
||||
* Returns the specified column.
|
||||
|
@ -2336,7 +2362,6 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
*/
|
||||
boolean isScalar();
|
||||
|
||||
|
||||
/**
|
||||
* Returns the shape of this ndarray
|
||||
*
|
||||
|
@ -2346,7 +2371,7 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
|
||||
/**
|
||||
* Returns shape descriptor of this ndarray
|
||||
* @return
|
||||
* @return shape descriptor
|
||||
*/
|
||||
LongShapeDescriptor shapeDescriptor();
|
||||
|
||||
|
@ -2386,7 +2411,6 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
*/
|
||||
INDArray broadcast(long... shape);
|
||||
|
||||
|
||||
/**
|
||||
* Broadcasts this ndarray to be the specified shape
|
||||
*
|
||||
|
@ -2394,7 +2418,6 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
*/
|
||||
INDArray broadcast(INDArray result);
|
||||
|
||||
|
||||
/**
|
||||
* Returns a scalar (individual element)
|
||||
* of a scalar ndarray
|
||||
|
@ -2413,9 +2436,9 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
/**
|
||||
* This method checks 2 INDArrays equality with given eps
|
||||
*
|
||||
* @param o
|
||||
* @param o INDArray to compare against.
|
||||
* @param eps Epsilon value to use for the quality operation
|
||||
* @return
|
||||
* @return True if ndarrays are equal within eps.
|
||||
*/
|
||||
boolean equalsWithEps(Object o, double eps);
|
||||
|
||||
|
@ -2448,7 +2471,7 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
/**
|
||||
* Remainder operator
|
||||
* @param denominator the denominator
|
||||
* @return
|
||||
* @return remainder
|
||||
*/
|
||||
INDArray remainder(INDArray denominator);
|
||||
|
||||
|
@ -2456,75 +2479,86 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
* Remainder operator
|
||||
* @param denominator the denominator
|
||||
* @param result the result array to put this in
|
||||
* @return
|
||||
* @return Remainder
|
||||
*/
|
||||
INDArray remainder(INDArray denominator, INDArray result);
|
||||
|
||||
/**
|
||||
* The scalar denominator
|
||||
* The scalar remainder
|
||||
* @param denominator the denominator as a scalar
|
||||
* @return
|
||||
* @return Remainder
|
||||
*/
|
||||
INDArray remainder(Number denominator);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param denominator
|
||||
* @param result
|
||||
* @return
|
||||
* The scalar remainder
|
||||
* @param denominator the denominator as a scalar
|
||||
* @param result the result array to put this in
|
||||
* @return Remainder
|
||||
*/
|
||||
INDArray remainder(Number denominator, INDArray result);
|
||||
|
||||
// TODO: Unused untested method.
|
||||
/**
|
||||
* In place remainder
|
||||
* @param denominator
|
||||
* @return
|
||||
* @param denominator the denominator
|
||||
* @return Remainder
|
||||
*/
|
||||
INDArray remainderi(INDArray denominator);
|
||||
|
||||
// TODO: Unused untested method.
|
||||
/**
|
||||
* In place remainder
|
||||
* @param denominator
|
||||
* @return
|
||||
* @param denominator the denominator
|
||||
* @return Remainder
|
||||
*/
|
||||
INDArray remainderi(Number denominator);
|
||||
|
||||
/**
|
||||
* remainder of division
|
||||
* @param denominator the array of denominators for each element
|
||||
* in this array
|
||||
* @return
|
||||
* @param denominator the array of denominators for each element in this array
|
||||
* @return array of remainders
|
||||
*/
|
||||
INDArray fmod(INDArray denominator);
|
||||
|
||||
/**
|
||||
* remainder of division
|
||||
* @param denominator the
|
||||
* @param denominator the array of denominators for each element in this array
|
||||
* @param result the result array
|
||||
* @return
|
||||
* @return array of remainders
|
||||
*/
|
||||
INDArray fmod(INDArray denominator, INDArray result);
|
||||
|
||||
/**
|
||||
* remainder of division by scalar.
|
||||
*
|
||||
* @param denominator
|
||||
* @return
|
||||
* @param denominator the denominator
|
||||
* @return array of remainders
|
||||
*/
|
||||
INDArray fmod(Number denominator);
|
||||
|
||||
/**
|
||||
* remainder of division by scalar.
|
||||
*
|
||||
* @param denominator the denominator
|
||||
* @param result the result array
|
||||
* @return array of remainders
|
||||
*/
|
||||
INDArray fmod(Number denominator, INDArray result);
|
||||
|
||||
// TODO: Unused untested method.
|
||||
/**
|
||||
* In place fmod
|
||||
* @param denominator
|
||||
* @return
|
||||
* @param denominator the array of denominators for each element in this array
|
||||
* @return array of remainders
|
||||
*/
|
||||
INDArray fmodi(INDArray denominator);
|
||||
|
||||
// TODO: Unused untested method.
|
||||
/**
|
||||
* In place fmod
|
||||
* @param denominator
|
||||
* @return
|
||||
* @param denominator the denominator as a scalar
|
||||
* @return array of remainders
|
||||
*/
|
||||
INDArray fmodi(Number denominator);
|
||||
|
||||
|
@ -2546,7 +2580,7 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
* This method checks, if given attached INDArray is still in scope of its parent Workspace
|
||||
*
|
||||
* PLEASE NOTE: if this INDArray isn't attached to any Workspace, this method will return true
|
||||
* @return
|
||||
* @return true if attached to workspace.
|
||||
*/
|
||||
boolean isInScope();
|
||||
|
||||
|
@ -2563,12 +2597,11 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
/**
|
||||
* This method detaches INDArray from current Workspace, and attaches it to Workspace above, if any.
|
||||
*
|
||||
* PLEASE NOTE: If this INDArray instance is
|
||||
* NOT attached - it will be returned unmodified.
|
||||
* PLEASE NOTE: If this INDArray instance is NOT attached - it will be returned unmodified.
|
||||
* PLEASE NOTE: If current Workspace is the top-tier one,
|
||||
* effect will be equal to detach() call - detached copy will be returned
|
||||
*
|
||||
* @return
|
||||
* @return this ndarray or a detached copy.
|
||||
*/
|
||||
INDArray leverage();
|
||||
|
||||
|
@ -2576,8 +2609,6 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
* This method detaches INDArray from current Workspace, and attaches it to Workspace with a given Id - if a workspace
|
||||
* with that ID exists. If no workspace with the specified ID exists, the current INDArray is returned unmodified.
|
||||
*
|
||||
* @param id ID of the workspace to leverage to
|
||||
* @return
|
||||
* @see #leverageTo(String, boolean)
|
||||
*/
|
||||
INDArray leverageTo(String id);
|
||||
|
@ -2635,7 +2666,7 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
* This method returns percentile value for this INDArray
|
||||
*
|
||||
* @param percentile target percentile in range of 0..100
|
||||
* @return
|
||||
* @return percentile value
|
||||
*/
|
||||
Number percentileNumber(Number percentile);
|
||||
|
||||
|
@ -2648,29 +2679,28 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
|
||||
/**
|
||||
* This method returns median along given dimension(s)
|
||||
* @param dimension
|
||||
* @param dimension Dimension to calculate median
|
||||
* @return Median along specified dimensions
|
||||
*/
|
||||
INDArray median(int... dimension);
|
||||
|
||||
/**
|
||||
* This method returns median along given dimension(s)
|
||||
* This method returns percentile along given dimension(s)
|
||||
* @param percentile target percentile in range of 0..100
|
||||
* @param dimension Dimension to calculate percentile for
|
||||
* @return
|
||||
* @return array with percentiles
|
||||
*/
|
||||
INDArray percentile(Number percentile, int... dimension);
|
||||
|
||||
/**
|
||||
/*
|
||||
* ------------ Sparse methods ------------
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Return a array of non-major pointers
|
||||
* i.e. return the column indexes in case of row-major ndarray
|
||||
* @return a DataBuffer of indexes
|
||||
* */
|
||||
*/
|
||||
DataBuffer getVectorCoordinates();
|
||||
|
||||
/**
|
||||
|
@ -2681,7 +2711,7 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
/**
|
||||
* Return the number of non-null element
|
||||
* @return nnz
|
||||
* */
|
||||
*/
|
||||
int nnz();
|
||||
|
||||
/**
|
||||
|
@ -2691,15 +2721,18 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
* */
|
||||
SparseFormat getFormat();
|
||||
|
||||
//TODO: Undocumented but often used method.
|
||||
int[] flags();
|
||||
|
||||
//TODO: Undocumented but often used method.
|
||||
int[] hiddenDimensions();
|
||||
|
||||
//TODO: Undocumented but often used method.
|
||||
int[] sparseOffsets();
|
||||
|
||||
//TODO: Undocumented but often used method.
|
||||
int underlyingRank();
|
||||
|
||||
|
||||
/**
|
||||
* Add an {@link INDArray}
|
||||
* to flatbuffers builder
|
||||
|
@ -2710,19 +2743,19 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
|
||||
/**
|
||||
* This method returns true if this INDArray is special case: no-value INDArray
|
||||
* @return
|
||||
* @return True if empty.
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* This method returns shapeInformation as jvm long array
|
||||
* @return
|
||||
* @return shapeInformation
|
||||
*/
|
||||
long[] shapeInfoJava();
|
||||
|
||||
/**
|
||||
* This method returns dtype for this INDArray
|
||||
* @return
|
||||
* @return Datattype
|
||||
*/
|
||||
DataType dataType();
|
||||
|
||||
|
@ -2734,45 +2767,45 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
|
||||
/**
|
||||
* This method checks if this INDArray instance is one of integer types
|
||||
* @return
|
||||
* @return true if integer type
|
||||
*/
|
||||
boolean isZ();
|
||||
|
||||
/**
|
||||
* This method checks if this INDArray instance has boolean type
|
||||
* @return
|
||||
* @return true if boolean type.
|
||||
*/
|
||||
boolean isB();
|
||||
|
||||
/**
|
||||
* This method checks if this INDArray instance has String type
|
||||
* @return
|
||||
* @return true if string type.
|
||||
*/
|
||||
boolean isS();
|
||||
|
||||
/**
|
||||
* This method cast elements of this INDArray to new data type
|
||||
*
|
||||
* @param dataType
|
||||
* @return
|
||||
* @param dataType new datatype.
|
||||
* @return this if datatype matches, otherwise a new array of specified datatype.
|
||||
*/
|
||||
INDArray castTo(DataType dataType);
|
||||
|
||||
/**
|
||||
* This method checks if all elements within this array are non-zero (or true, in case of boolean)
|
||||
* @return
|
||||
* @return true if all non-zero.
|
||||
*/
|
||||
boolean all();
|
||||
|
||||
/**
|
||||
* This method checks if any of the elements within this array are non-zero (or true, in case of boolean)
|
||||
* @return
|
||||
* @return true if any non-zero.
|
||||
*/
|
||||
boolean any();
|
||||
|
||||
/**
|
||||
* This method checks if any of the elements within this array are non-zero (or true, in case of boolean)
|
||||
* @return
|
||||
* @return true if any non-zero
|
||||
*/
|
||||
boolean none();
|
||||
|
||||
|
@ -2798,35 +2831,29 @@ public interface INDArray extends Serializable, AutoCloseable {
|
|||
|
||||
/**
|
||||
* This method returns empty array with the same dtype/order/shape as this one
|
||||
* @return
|
||||
* @return empty array with the same dtype/order/shape
|
||||
*/
|
||||
INDArray like();
|
||||
|
||||
/**
|
||||
* This method returns uninitialized array with the same dtype/order/shape as this one
|
||||
* @return
|
||||
* @return uninitialized array with the same dtype/order/shape
|
||||
*/
|
||||
INDArray ulike();
|
||||
|
||||
/**
|
||||
* This method returns array with gains for Barnes-Hut-Tsne algorithm
|
||||
* @return
|
||||
*/
|
||||
//INDArray[] gains(INDArray input, INDArray gradx, INDArray epsilon);
|
||||
|
||||
/**
|
||||
* Get a string representation of the array with configurable formatting
|
||||
* @param options format options
|
||||
*/
|
||||
String toString(@NonNull NDArrayStrings options);
|
||||
|
||||
|
||||
/**
|
||||
* Get a string representation of the array
|
||||
*
|
||||
* @param maxElements Summarize if more than maxElements in the array
|
||||
* @param forceSummarize Force a summary instead of a full print
|
||||
* @param precision The number of decimals to print. Doesn't print trailing 0s if negative
|
||||
* @return string representation of the array
|
||||
*/
|
||||
String toString(long maxElements, boolean forceSummarize, int precision);
|
||||
|
||||
|
|
|
@ -28,28 +28,11 @@ public interface ISparseNDArray extends INDArray {
|
|||
*
|
||||
* */
|
||||
|
||||
/**
|
||||
* Return a array of non-major pointers
|
||||
* i.e. return the column indexes in case of row-major ndarray
|
||||
* @return a DataBuffer of indexes
|
||||
* */
|
||||
DataBuffer getVectorCoordinates();
|
||||
|
||||
/**
|
||||
* Return a dense representation of the sparse ndarray
|
||||
* */
|
||||
INDArray toDense();
|
||||
|
||||
/**
|
||||
* Return the number of non-null element
|
||||
* @return nnz
|
||||
* */
|
||||
int nnz();
|
||||
|
||||
/**
|
||||
* Return the sparse format (i.e COO, CSR, ...)
|
||||
* @return format
|
||||
* @see SparseFormat
|
||||
* */
|
||||
SparseFormat getFormat();
|
||||
}
|
||||
|
|
|
@ -544,13 +544,6 @@ public class JCublasNDArray extends BaseNDArray {
|
|||
return LongShapeDescriptor.fromShape(shape(), stride(), elementWiseStride(), ordering(), dataType(), isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* This method does direct array copy. Impossible to use on views or mixed orders.
|
||||
*
|
||||
* PLEASE NOTE: YOU SHOULD NEVER USE THIS METHOD, UNLESS YOU 100% CLEAR ABOUT IT
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public INDArray unsafeDuplication() {
|
||||
return unsafeDuplication(true);
|
||||
|
@ -717,14 +710,6 @@ public class JCublasNDArray extends BaseNDArray {
|
|||
return copy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method pulls this INDArray into current Workspace.
|
||||
*
|
||||
* PLEASE NOTE: If there's no current Workspace - INDArray returned as is
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public INDArray migrate() {
|
||||
WorkspaceUtils.assertValidArray(this, "Cannot leverage INDArray to new workspace");
|
||||
|
|
|
@ -114,11 +114,6 @@ public class JcusparseNDArrayCSR extends BaseSparseNDArrayCSR {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns true if this INDArray is special case: no-value INDArray
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
|
|
@ -459,13 +459,6 @@ public class NDArray extends BaseNDArray {
|
|||
return new BaseNDArrayProxy(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method does direct array copy. Impossible to use on views or mixed orders.
|
||||
*
|
||||
* PLEASE NOTE: YOU SHOULD NEVER USE THIS METHOD, UNLESS YOU 100% CLEAR ABOUT IT
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public INDArray unsafeDuplication() {
|
||||
WorkspaceUtils.assertValidArray(this, "Cannot duplicate array");
|
||||
|
|
|
@ -124,11 +124,6 @@ public class SparseNDArrayCSR extends BaseSparseNDArrayCSR {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns true if this INDArray is special case: no-value INDArray
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue