Skip to content

Commit

Permalink
Merge pull request #16 from crazylyf/master
Browse files Browse the repository at this point in the history
Fix infinite iteration in `organize_samples`
  • Loading branch information
jwyang committed Sep 19, 2017
2 parents 21754cc + 510ee1b commit d43251d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion train.lua
Expand Up @@ -336,7 +336,9 @@ function organize_samples(X, y)
-- compute the size of triplet samples
local num_neg_sampling = opt.num_nsampling
if nclusters <= opt.num_nsampling then
local num_neg_sampling = nclusters - 1
--local num_neg_sampling = nclusters - 1 --> This line will lead to infinite iteration afterwards, if
--> nclusters <= opt.num_nsampling. Occurs often when batchSize is relatively small
num_neg_sampling = nclusters - 1
end
local num_triplet = 0
for i = 1, nclusters do
Expand Down

0 comments on commit d43251d

Please sign in to comment.