Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about prop_C3 and prop_bottleneck #12

Open
MaxwellHogan opened this issue Jan 10, 2024 · 0 comments
Open

Question about prop_C3 and prop_bottleneck #12

MaxwellHogan opened this issue Jan 10, 2024 · 0 comments

Comments

@MaxwellHogan
Copy link

MaxwellHogan commented Jan 10, 2024

I have a question about your implementation of the back propagation processes you have implemented for the C3 block and the bottleneck block.

From my understanding all the relevance should propagated backwards through the network - that's why in innvestigator.py you have rev_model = self.inverter.module_list[::-1]

However that logic doesn't seem to be strictly followed in the prop_c3 as you call the inverter on each block of the bottleneck in order, moreover, Conv3 seems to be ignored - as indicated below:

def prop_C3(*args):

    inverter, mod, relevance = args
    msg = relevance.scatter(which=-1)

    ## invert mod.cv3 

    c_ = msg.size(1)

    msg_cv1 = msg[:, : (c_ // 2), ...]
    msg_cv2 = msg[:, (c_ // 2) :, ...]

    for m1 in mod.m: <--- RIGHT HERE 
        msg_cv1 = inverter(m1, msg_cv1)
    
    msg = inverter(mod.cv1, msg_cv1) + inverter(mod.cv2, msg_cv2)

    relevance.gather([(-1, msg)])

    return relevance

The same is the case in prop_Bottleneck as you invert cv1, then cv2, also how do you deal with the addition as the forward function is:

y = x + conv2( conv1 ( x ))

def prop_Bottleneck(*args):

    inverter, mod, relevance_in = args

    ar = mod.cv2.conv.out_tensor.abs()
    ax = mod.cv1.conv.in_tensor.abs()

    relevance = relevance_in
    relevance = inverter(mod.cv1, relevance)
    relevance = inverter(mod.cv2, relevance)

    return relevance

My question is why is this the case, is it taken care of in another part of the code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant