Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions mctx/_src/policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ def muzero_policy(
# Running the search.
interior_action_selection_fn = functools.partial(
action_selection.muzero_action_selection,
pb_c_base=pb_c_base,
pb_c_init=pb_c_init,
pb_c_base=pb_c_base, # pyrefly: ignore[bad-argument-type]
pb_c_init=pb_c_init, # pyrefly: ignore[bad-argument-type]
qtransform=qtransform)
root_action_selection_fn = functools.partial(
interior_action_selection_fn,
Expand Down Expand Up @@ -215,7 +215,7 @@ def gumbel_muzero_policy(
considered_visit = jnp.max(summary.visit_counts, axis=-1, keepdims=True)
# The completed_qvalues include imputed values for unvisited actions.
completed_qvalues = jax.vmap(qtransform, in_axes=[0, None])( # pytype: disable=wrong-arg-types # numpy-scalars # pylint: disable=line-too-long
search_tree, search_tree.ROOT_INDEX)
search_tree, search_tree.ROOT_INDEX) # pyrefly: ignore[bad-argument-type]
to_argmax = seq_halving.score_considered(
considered_visit, gumbel, root.prior_logits, completed_qvalues,
summary.visit_counts)
Expand Down Expand Up @@ -338,15 +338,17 @@ def stochastic_muzero_policy(

interior_decision_node_selection_fn = functools.partial(
action_selection.muzero_action_selection,
pb_c_base=pb_c_base,
pb_c_init=pb_c_init,
pb_c_base=pb_c_base, # pyrefly: ignore[bad-argument-type]
pb_c_init=pb_c_init, # pyrefly: ignore[bad-argument-type]
qtransform=qtransform)

interior_action_selection_fn = _make_stochastic_action_selection_fn(
interior_decision_node_selection_fn, num_actions)

root_action_selection_fn = functools.partial(
interior_action_selection_fn, depth=0)
interior_action_selection_fn,
depth=0, # pyrefly: ignore[unexpected-keyword]
)

search_tree = search.search(
params=params,
Expand Down
2 changes: 1 addition & 1 deletion mctx/_src/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def body_fun(state):

# Returning a node with a selected action.
# The action can be already visited, if the max_depth is reached.
return end_state.node_index, end_state.action
return end_state.node_index, end_state.action # pyrefly: ignore[bad-return]


def expand(
Expand Down
Loading