Skip to content

Commit

Permalink
cnn_train.m: fixes a bug in computing the errors when using more than…
Browse files Browse the repository at this point in the history
… one sub batch
  • Loading branch information
vedaldi committed Apr 28, 2015
1 parent 80ef8a5 commit 1db6764
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions examples/cnn_train.m
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@
batchSize = min(opts.batchSize, numel(subset) - t + 1) ;
batchTime = tic ;
numDone = 0 ;
error = [] ;
for s=1:opts.numSubBatches
% get this image batch and prefetch the next
batchStart = t + (labindex-1) + (s-1) * numlabs ;
Expand Down Expand Up @@ -283,9 +284,9 @@
'sync', opts.sync) ;

% accumulate training errors
error = [...
error = sum([error, [...
sum(double(gather(res(end).x))) ;
reshape(opts.errorFunction(opts, labels, res),[],1) ; ] ;
reshape(opts.errorFunction(opts, labels, res),[],1) ; ]],2) ;
numDone = numDone + numel(batch) ;
end

Expand Down

0 comments on commit 1db6764

Please sign in to comment.