test_class.file: deepnetts-core/src/test/java/deepnetts/net/layers/OutputLayerTest.java
test_class.identifier: OutputLayerTest
test_case.body: @Test
      public void testForward() {
          
          RandomGenerator.getDefault().initSeed(123);         // initialize weights using specified random seed
          Tensor input = new Tensor(0.1f, 0.2f, 0.3f, 0.4f, 0.5f); // input vector for this layer (output for previous layer)
          Tensor weights = new Tensor(5, 10); 
          WeightsInit.uniform(weights.getValues(), 5); // "[0.19961303, -0.23501621, 0.43907326, -0.17747784, -0.22066136, 0.06630343, 0.097314, -0.21566293, 0.273578, 0.10945064, 0.33577937, 0.044093937, 0.19323963, -0.3021235, -0.38288906, 0.16261822, 0.26498383, -0.207817, 0.070406556, -0.23022851, 0.36503863, 0.091478825, -0.31402034, -0.25345784, 0.42504954, -0.037393004, -0.38854277, -0.36758634, -0.38503492, -0.33786723, -0.36604232, -0.14479709, -0.06755906, 0.38639867, 0.3348655, 0.15910655, 0.06717491, -0.4455302, -0.09257606, -1.219213E-4, -0.21616945, 0.43006968, -0.31055218, 0.2699433, -0.214278, 0.25471163, -0.03427276, -0.43431506, -0.054469943, -0.23747501]" 
  
         Tensor expectedOutputs = new Tensor( 0.51053022f, 0.59142921f, 0.52648754f, 0.56102458f, 0.54380692f, 0.58635918f, 0.54137987f, 0.41367945f, 0.52289978f, 0.4961883f );
           
          // create prev fc layer with 5 outputs
          FullyConnectedLayer prevLayer = new FullyConnectedLayer(5);        
          prevLayer.setOutputs(input); // and set its ouput that will be used as input for next layer
                  
          // create instance of layer to test
          OutputLayer instance = new OutputLayer(10);
          instance.setPrevLayer(prevLayer);        
          instance.init(); // init weights structures
          instance.setWeights(weights); // set weights values
          instance.setBiases(new float[] {0.1f, 0.2f, 0.3f, 0.11f, 0.12f, 0.13f, 0.21f, 0.22f, 0.23f, 0.24f}); // set bias values
          
          // run forward pass
          instance.forward();
          
          // get layer outpputs
          Tensor actualOutputs = instance.getOutputs();
          
          assertArrayEquals(actualOutputs.getValues(), expectedOutputs.getValues(), 1e-7f);
      }
test_case.class_method_signature: OutputLayerTest.testForward()
test_case.full_signature: @Test public void testForward()
test_case.identifier: testForward
test_case.invocations: initSeed getDefault uniform getValues setOutputs setPrevLayer init setWeights setBiases forward getOutputs assertArrayEquals getValues getValues
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testForward()
focal_class.declarator: outputErrors
focal_class.modifier: protected
focal_class.original_string: protected float[] outputErrors;
focal_class.type: float[]
focal_class.var_name: outputErrors
focal_class.declarator: labels
focal_class.modifier: protected final
focal_class.original_string: protected final String[] labels;
focal_class.type: String[]
focal_class.var_name: labels
focal_class.declarator: lossType
focal_class.modifier: protected
focal_class.original_string: protected LossType lossType;
focal_class.type: LossType
focal_class.var_name: lossType
focal_class.declarator: targetClassIdx
focal_class.original_string: int targetClassIdx;
focal_class.type: int
focal_class.var_name: targetClassIdx
focal_class.file: deepnetts-core/src/main/java/deepnetts/net/layers/OutputLayer.java
focal_class.identifier: OutputLayer
focal_class.class_method_signature: OutputLayer.OutputLayer(int width)
focal_class.full_signature: public  OutputLayer(int width)
focal_class.identifier: OutputLayer
focal_class.modifiers: public
focal_class.parameters: (int width)
focal_class.signature:  OutputLayer(int width)
focal_class.class_method_signature: OutputLayer.OutputLayer(int width, ActivationType activationFunction)
focal_class.full_signature: public  OutputLayer(int width, ActivationType activationFunction)
focal_class.identifier: OutputLayer
focal_class.modifiers: public
focal_class.parameters: (int width, ActivationType activationFunction)
focal_class.signature:  OutputLayer(int width, ActivationType activationFunction)
focal_class.class_method_signature: OutputLayer.OutputLayer(String[] labels)
focal_class.full_signature: public  OutputLayer(String[] labels)
focal_class.identifier: OutputLayer
focal_class.modifiers: public
focal_class.parameters: (String[] labels)
focal_class.signature:  OutputLayer(String[] labels)
focal_class.class_method_signature: OutputLayer.OutputLayer(String[] labels, ActivationType activationFunction)
focal_class.full_signature: public  OutputLayer(String[] labels, ActivationType activationFunction)
focal_class.identifier: OutputLayer
focal_class.modifiers: public
focal_class.parameters: (String[] labels, ActivationType activationFunction)
focal_class.signature:  OutputLayer(String[] labels, ActivationType activationFunction)
focal_class.class_method_signature: OutputLayer.setOutputErrors(final float[] outputErrors)
focal_class.full_signature: public final void setOutputErrors(final float[] outputErrors)
focal_class.identifier: setOutputErrors
focal_class.modifiers: public final
focal_class.parameters: (final float[] outputErrors)
focal_class.return: void
focal_class.signature: void setOutputErrors(final float[] outputErrors)
focal_class.class_method_signature: OutputLayer.getOutputErrors()
focal_class.full_signature: public final float[] getOutputErrors()
focal_class.identifier: getOutputErrors
focal_class.modifiers: public final
focal_class.parameters: ()
focal_class.return: float[]
focal_class.signature: float[] getOutputErrors()
focal_class.class_method_signature: OutputLayer.getLossType()
focal_class.full_signature: public final LossType getLossType()
focal_class.identifier: getLossType
focal_class.modifiers: public final
focal_class.parameters: ()
focal_class.return: LossType
focal_class.signature: LossType getLossType()
focal_class.class_method_signature: OutputLayer.setLossType(LossType lossType)
focal_class.full_signature: public void setLossType(LossType lossType)
focal_class.identifier: setLossType
focal_class.modifiers: public
focal_class.parameters: (LossType lossType)
focal_class.return: void
focal_class.signature: void setLossType(LossType lossType)
focal_class.class_method_signature: OutputLayer.init()
focal_class.full_signature: @Override public void init()
focal_class.identifier: init
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void init()
focal_class.class_method_signature: OutputLayer.forward()
focal_class.full_signature: @Override public void forward()
focal_class.identifier: forward
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void forward()
focal_class.class_method_signature: OutputLayer.backward()
focal_class.full_signature: @Override public void backward()
focal_class.identifier: backward
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void backward()
focal_class.class_method_signature: OutputLayer.applyWeightChanges()
focal_class.full_signature: @Override public void applyWeightChanges()
focal_class.identifier: applyWeightChanges
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void applyWeightChanges()
focal_class.superclass: extends AbstractLayer
focal_method.body: @Override
      public void forward() {                
          outputs.copyFrom(biases);  // reset output to bias value        
          for (int outCol = 0; outCol < outputs.getCols(); outCol++) {  // for all neurons in this layer  | ForkJoin split this in two until you reach size which makes sense: number of calculations = inputCols * outputCols           
              for (int inCol = 0; inCol < inputs.getCols(); inCol++) {
                  outputs.add(outCol, inputs.get(inCol) * weights.get(inCol, outCol));    // add weighted sum
              }                        
              //outputs.set(outCol, ActivationFunctions.sigmoid(outputs.get(outCol)));      // apply activation function - could be tanh too
              outputs.set(outCol, ActivationFunctions.calc(activationType, outputs.get(outCol)));
          }             
      }
focal_method.class_method_signature: OutputLayer.forward()
focal_method.full_signature: @Override public void forward()
focal_method.identifier: forward
focal_method.invocations: copyFrom getCols getCols add get get set calc get
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void forward()