Skip to content
Open
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
2 changes: 1 addition & 1 deletion enn/losses/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def loss_fn(enn: base.EpistemicNetwork[base.Input, base.Output],
# index. We choose to average the state across epistemic indices and
# then perform basic error checking to make sure the shape is unchanged.
new_state = jax.tree_map(batch_mean, new_state)
jax.tree_multimap(
jax.tree_map(
lambda x, y: chex.assert_equal_shape([x, y]), new_state, state)
mean_metrics = jax.tree_map(batch_mean, metrics)

Expand Down
2 changes: 1 addition & 1 deletion enn/metrics/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def __call__(
state = self._get_init_stats()

# Update state
new_stats = jax.tree_multimap(jnp.add, state.extra, batch_stats)
new_stats = jax.tree_map(jnp.add, state.extra, batch_stats)
new_count = state.count + 1
new_value = _map_stats_to_ece(new_stats)
return metrics_base.MetricsState(
Expand Down
2 changes: 1 addition & 1 deletion enn/networks/ensembles.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def apply(params: hk.Params, states: hk.State, inputs: chex.Array,
sub_params = jax.tree_map(particle_selector, params)
sub_states = jax.tree_map(particle_selector, states)
out, new_sub_states = model.apply(sub_params, sub_states, inputs)
new_states = jax.tree_multimap(
new_states = jax.tree_map(
lambda s, nss: s.at[index, ...].set(nss), states, new_sub_states)
return out, new_states

Expand Down
2 changes: 1 addition & 1 deletion enn/networks/hypermodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def hyper_fn(inputs: chex.Array,
flat_output = jax.tree_map(lambda layer: layer(hyper_index), final_layers)

# Reshape this flattened output to the original base shapes (unflatten)
generated_params = jax.tree_multimap(jnp.reshape, flat_output, base_shapes)
generated_params = jax.tree_map(jnp.reshape, flat_output, base_shapes)

if scale:
# Scale the generated params such that expected variance of the raw
Expand Down