You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: SegmentationAccuracy.m
    path of file: ./repos/CCL
    
    the code of the file until where you have to start completion: classdef SegmentationAccuracy < dagnn.Loss

  properties (Transient)
    pixelAccuracy = 0
    meanAccuracy = 0
    meanIntersectionUnion = 0
    confusion = 0
    nClass = 59;
  end

  methods
    function outputs = forward(obj, inputs, params)
      predictions = gather(inputs{1}) ;
      labels = gather(inputs{2}) ;
      [~,predictions] = max(predictions, [], 3) ;

      % compute statistics only on accumulated pixels
      ok = labels > 0 ;
      numPixels = sum(ok(:)) ;
      obj.confusion = obj.confusion + ...
        accumarray([labels(ok),predictions(ok)],1,[obj.nClass obj.nClass]) ;

      % compute various statistics of the confusion matrix
      pos = sum(obj.confusion,2) ;
      res = sum(obj.confusion,1)' ;
      tp = diag(obj.confus
    
function outputs = forward(obj, inputs, params)
      predictions = gather(inputs{1}) ;
      labels = gather(inputs{2}) ;
      [~,predictions] = max(predictions, [], 3) ;

      % compute statistics only on accumulated pixels
      ok = labels > 0 ;
      numPixels = sum(ok(:)) ;
      obj.confusion = obj.confusion + ...
        accumarray([labels(ok),predictions(ok)],1,[obj.nClass obj.nClass]) ;

      % compute various statistics of the confusion matrix
      pos = sum(obj.confusion,2) ;
      res = sum(obj.confusion,1)' ;
      tp = diag(obj.confusion) ;

      obj.pixelAccuracy = sum(tp) / max(1,sum(obj.confusion(:))) ;
      obj.meanAccuracy = mean(tp ./ max(1, pos)) ;
      obj.meanIntersectionUnion = mean(tp ./ max(1, pos + res - tp)) ;

      obj.average = [obj.pixelAccuracy ; obj.meanAccuracy ; obj.meanIntersectionUnion] ;
      obj.numAveraged = obj.numAveraged + numPixels ;
      outputs{1} = obj.average ;
    end