Examples of AparapiStochasticPooling2D


Examples of com.github.neuralnetworks.calculation.neuronfunctions.AparapiStochasticPooling2D

  ValuesProvider vp = new ValuesProvider();
  vp.addValues(c.getInputLayer(), i1);
  vp.addValues(c.getOutputLayer(), o);

  AparapiStochasticPooling2D calc = new AparapiStochasticPooling2D();
  calc.calculate(connections, vp, c.getOutputLayer());

  assertEquals(2.08, o.get(0, 0), 0.01);
  assertEquals(2.08, o.get(0, 1), 0.01);
    }
View Full Code Here

Examples of com.github.neuralnetworks.calculation.neuronfunctions.AparapiStochasticPooling2D

    }
   
    public static void lcStochasticPooling(NeuralNetworkImpl nn) {
  if (nn.getLayerCalculator() instanceof LayerCalculatorImpl) {
      LayerCalculatorImpl lc = (LayerCalculatorImpl) nn.getLayerCalculator();
      nn.getLayers().stream().filter(l -> Util.isSubsampling(l)).forEach(l -> lc.addConnectionCalculator(l, new AparapiStochasticPooling2D()));
  } else {
      throw new IllegalArgumentException("LayerCalculator type not supported");
  }
    }
View Full Code Here

Examples of com.github.neuralnetworks.calculation.neuronfunctions.AparapiStochasticPooling2D

  ValuesProvider vp = TensorFactory.tensorProvider(c, 2, true);
  float[] src = new float[] { 1.6f, 1.6f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.4f, 2.4f };
  System.arraycopy(src, 0, vp.get(c.getInputLayer()).getElements(), vp.get(c.getInputLayer()).getStartIndex(), src.length);

  AparapiStochasticPooling2D calc = new AparapiStochasticPooling2D();
  calc.calculate(connections, vp, c.getOutputLayer());

  Tensor t = vp.get(c.getOutputLayer());

  assertEquals(2.08, t.get(0, 0, 0, 0), 0.01);
  assertEquals(2.08, t.get(0, 0, 0, 1), 0.01);
View Full Code Here

Examples of com.github.neuralnetworks.calculation.neuronfunctions.AparapiStochasticPooling2D

    }
   
    public static void lcStochasticPooling(NeuralNetworkImpl nn) {
  if (nn.getLayerCalculator() instanceof LayerCalculatorImpl) {
      LayerCalculatorImpl lc = (LayerCalculatorImpl) nn.getLayerCalculator();
      nn.getLayers().stream().filter(l -> Util.isSubsampling(l)).forEach(l -> lc.addConnectionCalculator(l, new AparapiStochasticPooling2D()));
  } else {
      throw new IllegalArgumentException("LayerCalculator type not supported");
  }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.