INDArray javadocs (#166)

* small fix of compiler warnings in nd4j.

Signed-off-by: Robert Altena <Rob@Ra-ai.com>

* indarray javadoc start.

Signed-off-by: Robert Altena <Rob@Ra-ai.com>
master
Robert Altena 2019-08-26 16:01:20 +09:00 committed by GitHub
parent daf5420f4c
commit 9a513a9aa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 47 deletions

View File

@ -142,21 +142,11 @@ public abstract class BaseNDArray implements INDArray, Iterable {
} }
/**
* Returns true if this array is compressed, and false otherwise
* @return
*/
@Override @Override
public boolean isCompressed() { public boolean isCompressed() {
return compressed; return compressed;
} }
/**
* This method marks INDArray instance as compressed
* PLEASE NOTE: Do not use this method unless you 100% have to
*
* @param reallyCompressed
*/
@Override @Override
public void markAsCompressed(boolean reallyCompressed) { public void markAsCompressed(boolean reallyCompressed) {
this.compressed = reallyCompressed; this.compressed = reallyCompressed;
@ -949,17 +939,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
@Override @Override
public int elementWiseStride() { public int elementWiseStride() {
/*
if(Shape.elementWiseStride(shapeInfo()) < 0 && !attemptedToFindElementWiseStride) {
INDArray reshapeAttempt = Shape.newShapeNoCopy(this,new int[]{1,length()}, ordering() == 'f');
if(reshapeAttempt != null && reshapeAttempt.elementWiseStride() > 0) {
Shape.setElementWiseStride(shapeInfo(), reshapeAttempt.stride(-1));
this.shapeInformation = Nd4j.getShapeInfoProvider().createShapeInformation(shape(), stride(), offset(),reshapeAttempt.stride(-1), ordering());
}
attemptedToFindElementWiseStride = true;
}
*/
return Shape.elementWiseStride(shapeInfoDataBuffer()); return Shape.elementWiseStride(shapeInfoDataBuffer());
} }
@ -5349,12 +5328,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
return jvmShapeInfo.shape; return jvmShapeInfo.shape;
} }
/**
* Returns the shape information debugging
* information
*
* @return the shape information debugging information
*/
@Override @Override
public String shapeInfoToString() { public String shapeInfoToString() {
return Shape.shapeToString(this); return Shape.shapeToString(this);

View File

@ -328,13 +328,11 @@ public abstract class BaseSparseNDArray implements ISparseNDArray {
return sparseInformation; return sparseInformation;
} }
@Override @Override
public LongBuffer shapeInfo() { public LongBuffer shapeInfo() {
return null; return null;
} }
@Override @Override
public boolean isCompressed() { public boolean isCompressed() {
return false; return false;
@ -364,7 +362,6 @@ public abstract class BaseSparseNDArray implements ISparseNDArray {
return Shape.sparseOffsets(sparseInformation); return Shape.sparseOffsets(sparseInformation);
} }
@Override @Override
public int stride(int dimension) { public int stride(int dimension) {
int rank = Shape.rank(shapeInformation); int rank = Shape.rank(shapeInformation);

View File

@ -41,45 +41,44 @@ import org.nd4j.linalg.string.NDArrayStrings;
*/ */
public interface INDArray extends Serializable, AutoCloseable { public interface INDArray extends Serializable, AutoCloseable {
/** /**
* Returns the shape information debugging * Returns the shape information debugging information
* information * @return the shape information.
* @return the shape information debugging information
*/ */
String shapeInfoToString(); String shapeInfoToString();
/** /**
* Shape info * Shape info
* @return * @return Shape info
*/ */
DataBuffer shapeInfoDataBuffer(); DataBuffer shapeInfoDataBuffer();
/** /**
* Sparse info * Sparse info
* @return * @return Sparse info.
*/ */
DataBuffer sparseInfoDataBuffer(); DataBuffer sparseInfoDataBuffer();
/** /**
* Shape info * Shape info
* @return * @return Shape info
*/ */
LongBuffer shapeInfo(); LongBuffer shapeInfo();
/** /**
* Returns true if this array is a view or not * Check if this array is a view or not.
* @return * @return true if array is a view.
*/ */
boolean isView(); boolean isView();
/** /**
* Returns true if this array is sparse * Check if this array is sparse
* @return * @return true if this array is sparse.
*/ */
boolean isSparse(); boolean isSparse();
/** /**
* Returns true if this array is compressed, and false otherwise * Check if this array is compressed.
* @return * @return true if this array is compressed.
*/ */
boolean isCompressed(); boolean isCompressed();
@ -87,11 +86,10 @@ public interface INDArray extends Serializable, AutoCloseable {
* This method marks INDArray instance as compressed * This method marks INDArray instance as compressed
* PLEASE NOTE: Do not use this method unless you 100% have to * PLEASE NOTE: Do not use this method unless you 100% have to
* *
* @param reallyCompressed * @param reallyCompressed new value for compressed.
*/ */
void markAsCompressed(boolean reallyCompressed); void markAsCompressed(boolean reallyCompressed);
/** /**
* Returns the rank of the ndarray (the number of dimensions). * Returns the rank of the ndarray (the number of dimensions).
* *

View File

@ -103,7 +103,6 @@ import java.text.NumberFormat;
import java.text.ParseException; import java.text.ParseException;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -153,7 +152,6 @@ public class Nd4j {
public static RandomFactory randomFactory; public static RandomFactory randomFactory;
private static MemoryWorkspaceManager workspaceManager; private static MemoryWorkspaceManager workspaceManager;
private static DeallocatorService deallocatorService; private static DeallocatorService deallocatorService;
private static final AtomicInteger numThreads = new AtomicInteger(-1);
private static AtomicReference<DataType> defaultFloatingPointDataType; private static AtomicReference<DataType> defaultFloatingPointDataType;
private static DataBufferFactory DATA_BUFFER_FACTORY_INSTANCE; private static DataBufferFactory DATA_BUFFER_FACTORY_INSTANCE;
@ -4755,7 +4753,7 @@ public class Nd4j {
* @param toStrip the ndarray to newShapeNoCopy * @param toStrip the ndarray to newShapeNoCopy
* @return the reshaped ndarray * @return the reshaped ndarray
*/ */
@SuppressWarnings("WeakerAccess") // Needs tests if part of public API. @SuppressWarnings({"unused"}) // Needs tests if part of public API.
public static INDArray stripOnes(INDArray toStrip) { public static INDArray stripOnes(INDArray toStrip) {
if (toStrip.isVector()) if (toStrip.isVector())
return toStrip; return toStrip;