From 4211f3b4cee9e392222d3b5e91febdd1f52ccb73 Mon Sep 17 00:00:00 2001 From: raver119 Date: Wed, 21 Aug 2019 08:53:36 +0300 Subject: [PATCH] one more scalar constructor fix Signed-off-by: raver119 --- .../org/nd4j/linalg/factory/BaseNDArrayFactory.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java b/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java index 53be087f2..e316ded84 100644 --- a/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java +++ b/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java @@ -1352,12 +1352,7 @@ public abstract class BaseNDArrayFactory implements NDArrayFactory { */ @Override public INDArray scalar(float value) { - if (Nd4j.dataType() == DataType.FLOAT || Nd4j.dataType() == DataType.HALF) - return create(new float[] {value}, new int[0], new int[0], 0); - else if (Nd4j.dataType() == DataType.DOUBLE) - return scalar((double) value); - else - return scalar((int) value); + return create(new float[] {value}, new long[0], new long[0], DataType.FLOAT, Nd4j.getMemoryManager().getCurrentWorkspace()); } /** @@ -1368,10 +1363,7 @@ public abstract class BaseNDArrayFactory implements NDArrayFactory { */ @Override public INDArray scalar(double value) { - if (Nd4j.dataType() == DataType.DOUBLE) - return create(new double[] {value}, new int[0], new int[0], 0); - else - return scalar((float) value); + return create(new double[] {value}, new long[0], new long[0], DataType.DOUBLE, Nd4j.getMemoryManager().getCurrentWorkspace()); } @Override