cjlin1 / simpleNN

BSD 3-Clause "New" or "Revised" License
48 stars 16 forks source link

idx_phiZ index out of range when GNsize > bsize #11

Closed andy920262 closed 4 years ago

andy920262 commented 4 years ago

I find 29th line in vTP.m will throw an error when I run NewtonCG with full MNIST dataset.

idx = net.idx_phiZ{m}(:, 1:num_v);

the second dim of idx_phiZ is nL * bsize, but num_v is nL * GNsize in CG operation, so it will run out of index range when GNsize > bsize.

it's initialized in 27th line in init_net.m:

net.idx_phiZ{m} = net.idx_phiZ{m}(:) + [0:nL*bsize-1]*dab;

I think maybe bsize should be max(bsize, GNsize)?

ccwang123 commented 4 years ago

Thank you! It is fixed.