Skip to content

Commit

Permalink
Rename corpus reference to train_corpus in blackbox_learner.py
Browse files Browse the repository at this point in the history
This patch renames the corpus refereince in blackbox_learner.py from
sampler to train_corpus to better represent what it actually is. This
patch also fixes an incorrect string as a byproduct of this where an
argument name in the docstring did not match the actual argument name.
  • Loading branch information
boomanaiden154 committed Sep 12, 2024
1 parent 2878b51 commit e362b85
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions compiler_opt/es/blackbox_learner.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class BlackboxLearner:

def __init__(self,
blackbox_opt: blackbox_optimizers.BlackboxOptimizer,
sampler: corpus.Corpus,
train_corpus: corpus.Corpus,
tf_policy_path: str,
output_dir: str,
policy_saver_fn: PolicySaverCallableType,
Expand All @@ -141,7 +141,7 @@ def __init__(self,

Args:
blackbox_opt: the blackbox optimizer to use
train_sampler: corpus_sampler for training data.
train_corpus: the training corpus to utiilize
tf_policy_path: where to write the tf policy
output_dir: the directory to write all outputs
policy_saver_fn: function to save a policy to cns
Expand All @@ -152,7 +152,7 @@ def __init__(self,
deadline: the deadline in seconds for requests to the inlining server.
"""
self._blackbox_opt = blackbox_opt
self._sampler = sampler
self._train_corpus = train_corpus
self._tf_policy_path = tf_policy_path
self._output_dir = output_dir
self._policy_saver_fn = policy_saver_fn
Expand Down Expand Up @@ -250,7 +250,8 @@ def _get_results(
perturbations: List[bytes]) -> List[concurrent.futures.Future]:
if not self._samples:
for _ in range(self._config.total_num_perturbations):
sample = self._sampler.sample(self._config.num_ir_repeats_within_worker)
sample = self._train_corpus.sample(
self._config.num_ir_repeats_within_worker)
self._samples.append(sample)
# add copy of sample for antithetic perturbation pair
if self._config.est_type == (
Expand Down

0 comments on commit e362b85

Please sign in to comment.