Java Code Examples for org.nd4j.linalg.util.ArrayUtil#buildHalfVector()
The following examples show how to use
org.nd4j.linalg.util.ArrayUtil#buildHalfVector() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShufflesTests.java From nd4j with Apache License 2.0 | 6 votes |
/** * There's SMALL chance this test will randomly fail, since spread isn't too big * @throws Exception */ @Test public void testHalfVectors1() throws Exception { int[] array1 = ArrayUtil.buildHalfVector(new Random(12), 20); int[] array2 = ArrayUtil.buildHalfVector(new Random(75), 20); assertFalse(Arrays.equals(array1, array2)); assertEquals(20, array1.length); assertEquals(20, array2.length); for (int i = 0; i < array1.length; i++) { if (i >= array1.length / 2) { assertEquals("Failed on element [" + i + "]", -1, array1[i]); assertEquals("Failed on element [" + i + "]", -1, array2[i]); } else { assertNotEquals("Failed on element [" + i + "]", -1, array1[i]); assertNotEquals("Failed on element [" + i + "]", -1, array2[i]); } } }
Example 2
Source File: ShufflesTests.java From nd4j with Apache License 2.0 | 4 votes |
@Test public void testHalfVectors() throws Exception { int[] array = ArrayUtil.buildHalfVector(new Random(12), 11); System.out.println("HalfVec: " + Arrays.toString(array)); }
Example 3
Source File: ArrayUtilsTests.java From nd4j with Apache License 2.0 | 4 votes |
@Test public void testHalfVector1() { int[] vector = ArrayUtil.buildHalfVector(new Random(), 12); log.error("Vector: {}", vector); }