From ba1d1b160b468ada88b62cde0456db10d95d72cc Mon Sep 17 00:00:00 2001 From: Robert Altena Date: Tue, 6 Aug 2019 19:14:45 +0900 Subject: [PATCH] remove method with unused parameter. (#102) Signed-off-by: Robert Altena --- .../nd4j/linalg/api/ndarray/BaseNDArray.java | 11 +---------- .../main/java/org/nd4j/linalg/factory/Nd4j.java | 17 ++--------------- .../nd4j/linalg/api/buffer/DataBufferTests.java | 2 +- 3 files changed, 4 insertions(+), 26 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 c18f70d4b..1d82ad7db 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 @@ -703,15 +703,6 @@ public abstract class BaseNDArray implements INDArray, Iterable { return buffer; } - protected static DataBuffer internalCreateBuffer(int[] data, long offset) { - val perfX = PerformanceTracker.getInstance().helperStartTransaction(); - - val buffer = Nd4j.createBuffer(data, offset); - PerformanceTracker.getInstance().helperRegisterTransaction(0, perfX, data.length * Nd4j.sizeOfDataType(buffer.dataType()), MemcpyDirection.HOST_TO_HOST); - - return buffer; - } - /** * * @param floatBuffer @@ -6086,7 +6077,7 @@ public abstract class BaseNDArray implements INDArray, Iterable { protected void read(ObjectInputStream s) { val headerShape = BaseDataBuffer.readHeader(s); - shapeInformation = Nd4j.createBuffer(new int[Shape.shapeInfoLength(rank())], 0); + shapeInformation = Nd4j.createBuffer(new int[Shape.shapeInfoLength(rank())]); shapeInformation.read(s, headerShape.getLeft(), headerShape.getMiddle(), headerShape.getRight()); setShapeInformation(Pair.create(shapeInformation, shapeInformation.asLong())); 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 07aa9cdc3..1317d67ed 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 @@ -1050,18 +1050,7 @@ public class Nd4j { ret = DATA_BUFFER_FACTORY_INSTANCE.createFloat(offset, data, length); return ret; } - - /** - * Create a buffer equal of length prod(shape) - * - * @param data the shape of the buffer to create - * @return the created buffer - */ - public static DataBuffer createBuffer(int[] data, long offset) { - DataBuffer ret = createTypedBuffer(data, DataType.INT, Nd4j.getMemoryManager().getCurrentWorkspace()); - return ret; - } - + /** * Creates a buffer of the specified length based on the data opType * @@ -1408,9 +1397,7 @@ public class Nd4j { * @return the created buffer */ public static DataBuffer createBuffer(int[] data) { - DataBuffer ret; - ret = Nd4j.getMemoryManager().getCurrentWorkspace() == null ? DATA_BUFFER_FACTORY_INSTANCE.createInt(data) : DATA_BUFFER_FACTORY_INSTANCE.createInt(data, Nd4j.getMemoryManager().getCurrentWorkspace()); - return ret; + return Nd4j.getMemoryManager().getCurrentWorkspace() == null ? DATA_BUFFER_FACTORY_INSTANCE.createInt(data) : DATA_BUFFER_FACTORY_INSTANCE.createInt(data, Nd4j.getMemoryManager().getCurrentWorkspace()); } /** diff --git a/nd4j/nd4j-backends/nd4j-tests/src/test/java/org/nd4j/linalg/api/buffer/DataBufferTests.java b/nd4j/nd4j-backends/nd4j-tests/src/test/java/org/nd4j/linalg/api/buffer/DataBufferTests.java index 4f690ea72..e5dd289cf 100644 --- a/nd4j/nd4j-backends/nd4j-tests/src/test/java/org/nd4j/linalg/api/buffer/DataBufferTests.java +++ b/nd4j/nd4j-backends/nd4j-tests/src/test/java/org/nd4j/linalg/api/buffer/DataBufferTests.java @@ -104,7 +104,7 @@ public class DataBufferTests extends BaseNd4jTest { assertEquals(useWs, i.isAttached()); testDBOps(i); - i = Nd4j.createBuffer(new int[]{1, 2, 3}, 0); + i = Nd4j.createBuffer(new int[]{1, 2, 3}); checkTypes(DataType.INT, i, 3); assertEquals(useWs, i.isAttached()); testDBOps(i);