@Test
  public void testLeadingOnes() {
    IComplexNDArray complexRand = Nd4j.complexRand(100, 1, 28, 28);
    assertArrayEquals(new int[] {100, 1, 28, 28}, complexRand.shape());
    IComplexNDArray arr = complexRand.linearView();
    for (int i = 0; i < arr.length(); i++) {
      arr.putScalar(i, arr.getComplex(i));
    }

    IComplexNDArray complexRand2 = Nd4j.complexRand(28, 28, 1);
    assertArrayEquals(new int[] {28, 28, 1}, complexRand2.shape());
    IComplexNDArray arr2 = complexRand.linearView();
    for (int i = 0; i < arr2.length(); i++) {
      arr2.putScalar(i, arr2.getComplex(i));
    }
  }
Пример #2
0
 @Test
 public void testOtherLinearView() {
   IComplexNDArray arr = Nd4j.complexLinSpace(1, 8, 8).reshape(2, 4);
   IComplexNDArray slices = arr.slice(0);
   IComplexNDArray slice1 = arr.slice(1);
   IComplexNDArray arrLinear = arr.linearView();
   System.out.println(arrLinear);
 }