Remove __dealloc__ from ParserBeam

This commit is contained in:
Matthew Honnibal 2017-11-13 18:18:08 +01:00
parent 6e641f46d4
commit 63ef9a2e73

View File

@ -66,12 +66,6 @@ cdef class ParserBeam(object):
self.beams.append(beam) self.beams.append(beam)
self.dones = [False] * len(self.beams) self.dones = [False] * len(self.beams)
def __dealloc__(self):
if self.beams is not None:
for beam in self.beams:
if beam is not None:
_cleanup(beam)
@property @property
def is_done(self): def is_done(self):
return all(b.is_done or self.dones[i] return all(b.is_done or self.dones[i]
@ -222,7 +216,8 @@ def update_beam(TransitionSystem moves, int nr_feature, int max_steps,
histories.append([]) histories.append([])
losses.append([]) losses.append([])
states_d_scores = get_gradient(moves.n_moves, beam_maps, histories, losses) states_d_scores = get_gradient(moves.n_moves, beam_maps, histories, losses)
return states_d_scores, backprops[:len(states_d_scores)] beams = list(pbeam.beams) + list(gbeam.beams)
return states_d_scores, backprops[:len(states_d_scores)], beams
def get_states(pbeams, gbeams, beam_map, nr_update): def get_states(pbeams, gbeams, beam_map, nr_update):