Examples of forEach()


Examples of com.github.neuralnetworks.tensor.Tensor.forEach()

  float[] e6 = t.getElements();
  t.forEach(i -> e6[i] = 0.5f);

  t = ((FullyConnected) secondAE.getConnection(secondAE.getHiddenLayer(), secondAE.getOutputLayer())).getWeights();
  float[] e7 = t.getElements();
  t.forEach(i -> e7[i] = 0.7f);

  t = ((FullyConnected) secondAE.getConnection(secondAE.getOutputBiasLayer(), secondAE.getOutputLayer())).getWeights();
  float[] e8 = t.getElements();
  t.forEach(i -> e8[i] = 0.9f);
View Full Code Here

Examples of com.github.neuralnetworks.tensor.Tensor.forEach()

  float[] e7 = t.getElements();
  t.forEach(i -> e7[i] = 0.7f);

  t = ((FullyConnected) secondAE.getConnection(secondAE.getOutputBiasLayer(), secondAE.getOutputLayer())).getWeights();
  float[] e8 = t.getElements();
  t.forEach(i -> e8[i] = 0.9f);

  Set<Layer> calculatedLayers = new HashSet<>();
  calculatedLayers.add(sae.getInputLayer());

  ValuesProvider results = TensorFactory.tensorProvider(sae, 1, true);
View Full Code Here

Examples of com.github.neuralnetworks.tensor.Tensor.forEach()

    }

    @Override
    public void calculate(List<Connections> connections, ValuesProvider valuesProvider, Layer targetLayer) {
  Tensor t = TensorFactory.tensor(targetLayer, connections, valuesProvider);
  t.forEach(i -> t.getElements()[i] = value);
    }

    public float getValue() {
        return value;
    }
View Full Code Here

Examples of com.github.neuralnetworks.tensor.Tensor.forEach()

    protected void calculateBias(Conv2DConnection bias, ValuesProvider vp) {
  if (bias != null) {
      Tensor biasValue = TensorFactory.tensor(bias.getInputLayer(), bias, vp);
      if (biasValue.getElements()[biasValue.getStartIndex()] == 0) {
    biasValue.forEach(i -> biasValue.getElements()[i] = 1);
      }

      Tensor v = TensorFactory.tensor(bias.getOutputLayer(), bias, vp);
      Tensor w = bias.getWeights();
      TensorIterator it = v.iterator();
View Full Code Here

Examples of com.github.neuralnetworks.tensor.Tensor.forEach()

  for (Layer l : nn.getLayers()) {
      if (Util.isBias(l)) {
    Tensor t = ((FullyConnected) l.getConnections().get(0)).getWeights();
    float[] elements = t.getElements();
    t.forEach(i -> assertEquals(0.5, elements[i], 0f));
      } else {
    Tensor t = ((FullyConnected) l.getConnections().get(0)).getWeights();
    float[] elements = t.getElements();
    t.forEach(i -> assertTrue(elements[i] >= -0.1f && elements[i] <= 0.1f && elements[i] != 0));
      }
View Full Code Here

Examples of com.github.neuralnetworks.tensor.Tensor.forEach()

    float[] elements = t.getElements();
    t.forEach(i -> assertEquals(0.5, elements[i], 0f));
      } else {
    Tensor t = ((FullyConnected) l.getConnections().get(0)).getWeights();
    float[] elements = t.getElements();
    t.forEach(i -> assertTrue(elements[i] >= -0.1f && elements[i] <= 0.1f && elements[i] != 0));
      }
  }

  rand = new NNRandomInitializer(new MersenneTwisterRandomInitializer(2f, 3f), new MersenneTwisterRandomInitializer(-2f, -1f));
  rand.initialize(nn);
View Full Code Here

Examples of com.github.neuralnetworks.tensor.Tensor.forEach()

  for (Layer l : nn.getLayers()) {
      if (Util.isBias(l)) {
    Tensor t = ((FullyConnected) l.getConnections().get(0)).getWeights();
    float[] elements = t.getElements();
    t.forEach(i -> assertTrue(elements[i] >= -2f && elements[i] <= -1f));
      } else {
    Tensor t = ((FullyConnected) l.getConnections().get(0)).getWeights();
    float[] elements = t.getElements();
    t.forEach(i -> assertTrue(elements[i] >= 2f && elements[i] <= 3f));
      }
View Full Code Here

Examples of com.github.neuralnetworks.tensor.Tensor.forEach()

    float[] elements = t.getElements();
    t.forEach(i -> assertTrue(elements[i] >= -2f && elements[i] <= -1f));
      } else {
    Tensor t = ((FullyConnected) l.getConnections().get(0)).getWeights();
    float[] elements = t.getElements();
    t.forEach(i -> assertTrue(elements[i] >= 2f && elements[i] <= 3f));
      }
  }
    }

    @Test
View Full Code Here

Examples of com.github.neuralnetworks.tensor.Tensor.forEach()

    protected void calculateBias(Connections bias, ValuesProvider valuesProvider) {
  if (bias != null) {
      Tensor biasValue = TensorFactory.tensor(bias.getInputLayer(), bias, valuesProvider);
      if (biasValue.get(new int[biasValue.getDimensions().length]) == 0) {
    biasValue.forEach(i -> biasValue.getElements()[i] = 1);
      }

      Matrix weights = ((FullyConnected) bias).getWeights();
      Matrix output = TensorFactory.tensor(bias.getOutputLayer(), bias, valuesProvider);
View Full Code Here

Examples of com.goodow.realtime.json.JsonArray.forEach()

            components.push(component.toJson());
          }
        }
      }
    });
    components.forEach(new ListIterator<JsonElement>() {
      @Override
      public void call(int index, JsonElement component) {
        createComponents.push(component);
      }
    });
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.