Skip to content

question about two lines in jvp #16

@frankaging

Description

@frankaging

https://github.com/saprmarks/feature-circuits/blob/main/attribution.py#L313-L314

            vjv = (upstream_act.grad @ right_vec).to_tensor()
            to_backprops[tuple(downstream_idx)].backward(retain_graph=True)

since this is looping over all downstream_idx, shouldn't we back prop first, and access the grad just in time for the downstream_idx (i.e., swap the order of these two lines)? it seems like the first iteration would be just all zeros? thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions