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 e04f20deb..2d9b8774c 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 @@ -3098,10 +3098,10 @@ public class Nd4j { } /** - * @deprecated use {@link Nd4j#randn(long, long...)} + * @deprecated use {@link Nd4j#randn(long, long[])} */ @Deprecated - public static INDArray randn(int[] shape, long seed) { + public static INDArray randn(long seed, int[] shape) { return randn(seed, ArrayUtil.toLongArray(shape)); } @@ -3111,60 +3111,11 @@ public class Nd4j { * @param shape the shape of the array * @return new array with random values */ - public static INDArray randn(long seed, @NonNull long... shape) { + public static INDArray randn(long seed, @NonNull long[] shape) { INDArray ret = Nd4j.createUninitialized(shape, order()); return randn(ret, seed); } - /** - * Random normal N(0, 1) - * - * @param rows the number of rows in the matrix - * @param columns the number of columns in the matrix - * @return new array with random values - */ - public static INDArray randn(long rows, long columns) { - INDArray ret = Nd4j.createUninitialized(new long[]{rows, columns}, order()); - return randn(ret); - } - - /** - * Random normal N(0,1) with the specified shape and array order - * - * @param order the order of the output array - * @param rows the number of rows in the matrix - * @param columns the number of columns in the matrix - */ - /*public static INDArray randn(char order, long rows, long columns) { - INDArray ret = Nd4j.createUninitialized(new long[]{rows, columns}, order); - return randn(ret); - }*/ - - /** - * Random normal using the specified seed - * - * @param rows the number of rows in the matrix - * @param columns the number of columns in the matrix - * @return new array with random values - */ - /*public static INDArray randn(long rows, long columns, long seed) { - INDArray ret = Nd4j.createUninitialized(new long[]{rows, columns}, order()); - return randn(ret, seed); - }*/ - - /** - * Random normal using the given rng - * - * @param rows the number of rows in the matrix - * @param columns the number of columns in the matrix - * @param r the random generator to use - * @return new array with random values - */ - /*public static INDArray randn(long rows, long columns, @NonNull org.nd4j.linalg.api.rng.Random r) { - INDArray ret = Nd4j.createUninitialized(new long[]{rows, columns}, order()); - return randn(ret, r); - }*/ - /** * @deprecated use {@link Nd4j#randn(org.nd4j.linalg.api.rng.Random, long...)} */ diff --git a/nd4j/nd4j-backends/nd4j-tests/src/test/java/org/nd4j/linalg/dataset/NormalizerStandardizeLabelsTest.java b/nd4j/nd4j-backends/nd4j-tests/src/test/java/org/nd4j/linalg/dataset/NormalizerStandardizeLabelsTest.java index ed9139f40..c0cd788b8 100644 --- a/nd4j/nd4j-backends/nd4j-tests/src/test/java/org/nd4j/linalg/dataset/NormalizerStandardizeLabelsTest.java +++ b/nd4j/nd4j-backends/nd4j-tests/src/test/java/org/nd4j/linalg/dataset/NormalizerStandardizeLabelsTest.java @@ -191,7 +191,7 @@ public class NormalizerStandardizeLabelsTest extends BaseNd4jTest { // transform ndarray as X = aA + bB * X INDArray randomFeatures = Nd4j.zeros(nSamples, nFeatures); while (i < nFeatures) { - INDArray randomSlice = Nd4j.randn(new int[]{nSamples, 1}, randSeed); + INDArray randomSlice = Nd4j.randn(randSeed, new long[]{nSamples, 1}); randomSlice.muli(aA.getScalar(0, i)); randomSlice.addi(bB.getScalar(0, i)); randomFeatures.putColumn(i, randomSlice); diff --git a/nd4j/nd4j-backends/nd4j-tests/src/test/java/org/nd4j/linalg/dataset/NormalizerStandardizeTest.java b/nd4j/nd4j-backends/nd4j-tests/src/test/java/org/nd4j/linalg/dataset/NormalizerStandardizeTest.java index 9372f2627..bdfcf596f 100644 --- a/nd4j/nd4j-backends/nd4j-tests/src/test/java/org/nd4j/linalg/dataset/NormalizerStandardizeTest.java +++ b/nd4j/nd4j-backends/nd4j-tests/src/test/java/org/nd4j/linalg/dataset/NormalizerStandardizeTest.java @@ -309,7 +309,7 @@ public class NormalizerStandardizeTest extends BaseNd4jTest { INDArray randomFeatures = Nd4j.zeros(nSamples, nFeatures); INDArray randomFeaturesTransform = Nd4j.zeros(nSamples, nFeatures); while (i < nFeatures) { - INDArray randomSlice = Nd4j.randn(new int[]{nSamples, 1}, randSeed); + INDArray randomSlice = Nd4j.randn(randSeed, new long[]{nSamples, 1}); randomFeaturesTransform.putColumn(i, randomSlice); randomSlice.muli(aA.getScalar(0, i)); randomSlice.addi(bB.getScalar(0, i)); diff --git a/nd4j/nd4j-backends/nd4j-tests/src/test/java/org/nd4j/linalg/rng/RandomTests.java b/nd4j/nd4j-backends/nd4j-tests/src/test/java/org/nd4j/linalg/rng/RandomTests.java index aa39be145..f95842cc2 100644 --- a/nd4j/nd4j-backends/nd4j-tests/src/test/java/org/nd4j/linalg/rng/RandomTests.java +++ b/nd4j/nd4j-backends/nd4j-tests/src/test/java/org/nd4j/linalg/rng/RandomTests.java @@ -906,8 +906,8 @@ public class RandomTests extends BaseNd4jTest { public void testSignatures1() { for (int x = 0; x < 100; x++) { - INDArray z1 = Nd4j.randn(new int[]{128, 1}, 5325235); - INDArray z2 = Nd4j.randn(new int[]{128, 1}, 5325235); + INDArray z1 = Nd4j.randn(5325235, new long[]{128, 1}); + INDArray z2 = Nd4j.randn(5325235, new long[]{128, 1}); assertEquals(z1, z2); }