Skip to content

question about method measure_idc #14

@Jacob-yen

Description

@Jacob-yen

@hasanferit @gerasimou
First and foremost, thanks so much for sharing the code! :)
I have a question about method measure_idc when I read the source code.
At the beginning of measure_idc, variable subject_layer(the index of the subject layer from which we get relevant neuron) is reassigned as subject_layer - 1

def measure_idc(model, model_name, test_inputs, subject_layer,
relevant_neurons, sel_class,
test_layer_outs, qtized, is_conv,
covered_combinations=()):
subject_layer = subject_layer - 1
for test_idx in range(len(test_inputs)):

Later in method measure_idc, the new subject_layer is used to get the output of the "subject layer".
for r in relevant_neurons:
lout.append(np.mean(test_layer_outs[subject_layer][test_idx][...,r]))
else:
lout = test_layer_outs[subject_layer][test_idx][relevant_neurons]

It seems that we get the relevant neurons of the subject layer(with index subject_layer), but we use the outputs of subject_layer - 1 layer to calculate the idc. That makes me really confused.
Please point out if I misunderstand the code.

I would like to thank you in advance for your time and look forward to hearing from you.

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