Skip to content

Commit

Permalink
Removed beam_size from class attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thrandis committed Jun 29, 2015
1 parent 4d201cf commit d21bace
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions blocks/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ def compute_initial_states_and_contexts(self, inputs):
outputs = self.initial_state_and_context_computer(
*[inputs[var] for var in self.inputs])
contexts = OrderedDict((n, outputs.pop(n)) for n in self.context_names)
self.beam_size = outputs.pop('beam_size')
beam_size = outputs.pop('beam_size')
initial_states = outputs
return contexts, initial_states
return contexts, initial_states, beam_size

def compute_logprobs(self, contexts, states):
"""Compute log probabilities of all possible outputs.
Expand Down Expand Up @@ -265,7 +265,7 @@ def search(self, input_values, eol_symbol, max_length,
if not self.compiled:
self.compile()

contexts, states = self.compute_initial_states_and_contexts(
contexts, states, beam_size = self.compute_initial_states_and_contexts(
input_values)

# This array will store all generated outputs, including those from
Expand All @@ -290,7 +290,7 @@ def search(self, input_values, eol_symbol, max_length,
# The `i == 0` is required because at the first step the beam
# size is effectively only 1.
(indexes, outputs), chosen_costs = self._smallest(
next_costs, self.beam_size, only_first_row=i == 0)
next_costs, beam_size, only_first_row=i == 0)

# Rearrange everything
for name in states:
Expand Down

0 comments on commit d21bace

Please sign in to comment.