def add_ablating_hooks(
    transformer_graph: TransformerHookGraph,
    ablation_specs: list[AblationSpec],
    batch_index: int,
) -> None:
    """This is a helper function that returns a TransformerHooks object containing hooks at naturally existing hook locations
    (e.g. MLP post-activations, rather than autoencoder latent activations) for the given
    scalar derivers, and a dictionary mapping each activation location type with a naturally existing hook to the activations requested
    (before it is filled with activations during forward passes)."""

    for ablation_spec in ablation_specs:
        (
            hook_fn,
            activation_location_type_and_pass_type,
            layer_index,
        ) = create_ablating_hook_fn(ablation_spec, batch_index=batch_index)

        transformer_graph.append(
            activation_location_type_and_pass_type,
            hook_fn,
            layer_indices=layer_index,
        )
This is a helper function that returns a TransformerHooks object containing hooks at naturally existing hook locations
    (e.g. MLP post-activations, rather than autoencoder latent activations) for the given
    scalar derivers, and a dictionary mapping each activation location type with a naturally existing hook to the activations requested
    (before it is filled with activations during forward passes).
neuron_explainer/activation_server/derived_scalar_computation.py