Skip to content

Commit

Permalink
Update agent.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaiyu Yang authored Oct 10, 2020
1 parent 85d3c85 commit 4c205a7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ASTactic/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ def action_seq_loss(logits_batch, actions_batch, opts):
sexp_cache = SexpCache('../sexp_cache', readonly=True)

def filter_env(env):
"Get the last 10 toplevel constants"
filtered_env = []
for const in [const for const in env['constants'] if const['qualid'].startswith('SerTop')][-10:]:
toplevel_consts = [const for const in env['constants'] if const['qualid'].startswith('SerTop')]
for const in toplevel_consts[-10:]:
ast = sexp_cache[const['sexp']]
filtered_env.append({'qualid': const['qualid'], 'ast': term_parser.parse(ast)})
return filtered_env
Expand Down

0 comments on commit 4c205a7

Please sign in to comment.