From 9a513a9aa66a9ad8efb3a498640963309512213d Mon Sep 17 00:00:00 2001 From: Robert Altena Date: Mon, 26 Aug 2019 16:01:20 +0900 Subject: [PATCH] INDArray javadocs (#166) * small fix of compiler warnings in nd4j. Signed-off-by: Robert Altena * indarray javadoc start. Signed-off-by: Robert Altena --- .../nd4j/linalg/api/ndarray/BaseNDArray.java | 27 ------------------- .../linalg/api/ndarray/BaseSparseNDArray.java | 3 --- .../org/nd4j/linalg/api/ndarray/INDArray.java | 26 +++++++++--------- .../java/org/nd4j/linalg/factory/Nd4j.java | 4 +-- 4 files changed, 13 insertions(+), 47 deletions(-) diff --git a/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseNDArray.java b/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseNDArray.java index 121ca2b43..c73a56c61 100644 --- a/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseNDArray.java +++ b/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseNDArray.java @@ -142,21 +142,11 @@ public abstract class BaseNDArray implements INDArray, Iterable { } - /** - * Returns true if this array is compressed, and false otherwise - * @return - */ @Override public boolean isCompressed() { return compressed; } - /** - * This method marks INDArray instance as compressed - * PLEASE NOTE: Do not use this method unless you 100% have to - * - * @param reallyCompressed - */ @Override public void markAsCompressed(boolean reallyCompressed) { this.compressed = reallyCompressed; @@ -949,17 +939,6 @@ public abstract class BaseNDArray implements INDArray, Iterable { @Override 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()); } @@ -5349,12 +5328,6 @@ public abstract class BaseNDArray implements INDArray, Iterable { return jvmShapeInfo.shape; } - /** - * Returns the shape information debugging - * information - * - * @return the shape information debugging information - */ @Override public String shapeInfoToString() { return Shape.shapeToString(this); diff --git a/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseSparseNDArray.java b/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseSparseNDArray.java index 3570ed7ad..5257be12e 100644 --- a/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseSparseNDArray.java +++ b/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseSparseNDArray.java @@ -328,13 +328,11 @@ public abstract class BaseSparseNDArray implements ISparseNDArray { return sparseInformation; } - @Override public LongBuffer shapeInfo() { return null; } - @Override public boolean isCompressed() { return false; @@ -364,7 +362,6 @@ public abstract class BaseSparseNDArray implements ISparseNDArray { return Shape.sparseOffsets(sparseInformation); } - @Override public int stride(int dimension) { int rank = Shape.rank(shapeInformation); diff --git a/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/INDArray.java b/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/INDArray.java index 727b5db6d..88cda5b4f 100644 --- a/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/INDArray.java +++ b/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/INDArray.java @@ -41,45 +41,44 @@ import org.nd4j.linalg.string.NDArrayStrings; */ public interface INDArray extends Serializable, AutoCloseable { /** - * Returns the shape information debugging - * information - * @return the shape information debugging information + * Returns the shape information debugging information + * @return the shape information. */ String shapeInfoToString(); /** * Shape info - * @return + * @return Shape info */ DataBuffer shapeInfoDataBuffer(); /** * Sparse info - * @return + * @return Sparse info. */ DataBuffer sparseInfoDataBuffer(); /** * Shape info - * @return + * @return Shape info */ LongBuffer shapeInfo(); /** - * Returns true if this array is a view or not - * @return + * Check if this array is a view or not. + * @return true if array is a view. */ boolean isView(); /** - * Returns true if this array is sparse - * @return + * Check if this array is sparse + * @return true if this array is sparse. */ boolean isSparse(); /** - * Returns true if this array is compressed, and false otherwise - * @return + * Check if this array is compressed. + * @return true if this array is compressed. */ boolean isCompressed(); @@ -87,11 +86,10 @@ public interface INDArray extends Serializable, AutoCloseable { * This method marks INDArray instance as compressed * PLEASE NOTE: Do not use this method unless you 100% have to * - * @param reallyCompressed + * @param reallyCompressed new value for compressed. */ void markAsCompressed(boolean reallyCompressed); - /** * Returns the rank of the ndarray (the number of dimensions). * diff --git a/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/Nd4j.java b/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/Nd4j.java index eb3250e3c..d2a4f94a4 100644 --- a/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/Nd4j.java +++ b/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/Nd4j.java @@ -103,7 +103,6 @@ import java.text.NumberFormat; import java.text.ParseException; import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import java.util.logging.Logger; @@ -153,7 +152,6 @@ public class Nd4j { public static RandomFactory randomFactory; private static MemoryWorkspaceManager workspaceManager; private static DeallocatorService deallocatorService; - private static final AtomicInteger numThreads = new AtomicInteger(-1); private static AtomicReference defaultFloatingPointDataType; private static DataBufferFactory DATA_BUFFER_FACTORY_INSTANCE; @@ -4755,7 +4753,7 @@ public class Nd4j { * @param toStrip the ndarray to newShapeNoCopy * @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) { if (toStrip.isVector()) return toStrip;