code: @Override
      public INDArray computeScoreForExamples(double fullNetRegTerm, LayerWorkspaceMgr workspaceMgr) {
          //For CNN: need to sum up the score over each x/y location before returning
  
          if (input == null || labels == null)
              throw new IllegalStateException("Cannot calculate score without input and labels " + layerId());
  
          INDArray input2d = ConvolutionUtils.reshape4dTo2d(input, workspaceMgr, ArrayType.FF_WORKING_MEM);
          INDArray labels2d = ConvolutionUtils.reshape4dTo2d(labels, workspaceMgr, ArrayType.FF_WORKING_MEM);
          INDArray maskReshaped = ConvolutionUtils.reshapeMaskIfRequired(maskArray, input, workspaceMgr, ArrayType.FF_WORKING_MEM);
  
          ILossFunction lossFunction = layerConf().getLossFn();
          INDArray scoreArray =
                  lossFunction.computeScoreArray(labels2d, input2d, layerConf().getActivationFn(), maskReshaped);
          //scoreArray: shape [minibatch*h*w, 1]
          //Reshape it to [minibatch, 1, h, w] then sum over x/y to give [minibatch, 1]
  
          val newShape = input.shape().clone();
          newShape[1] = 1;
  
          // FIXME
          INDArray scoreArrayTs = ConvolutionUtils.reshape2dTo4d(scoreArray, ArrayUtil.toInts(newShape), workspaceMgr, ArrayType.FF_WORKING_MEM);
          INDArray summedScores = scoreArrayTs.sum(1,2,3).reshape(scoreArrayTs.size(0), 1);
  
          if (fullNetRegTerm != 0.0) {
              summedScores.addi(fullNetRegTerm);
          }
  
          return workspaceMgr.leverageTo(ArrayType.ACTIVATIONS, summedScores);
      }
docs: Compute the score for each example individually, after labels and input have been set.
  
  @param fullNetRegTerm Regularization score term for the entire network (or, 0.0 to not include regularization)
  @return A column INDArray of shape [numExamples,1], where entry i is the score of the ith example