Shuffle histories in beam parser

This commit is contained in:
Matthew Honnibal 2016-08-05 18:25:16 +02:00
parent de82552a13
commit d1511e816a

View File

@ -118,6 +118,7 @@ cdef class BeamParser(Parser):
violn.check_crf(pred, gold)
min_grad = 0.1 ** (itn+1)
histories = zip(violn.p_probs, violn.p_hist) + zip(violn.g_probs, violn.g_hist)
random.shuffle(histories)
for grad, hist in histories:
assert not math.isnan(grad) and not math.isinf(grad)
if abs(grad) >= min_grad: