CHIP_NeurIPS2021
CHIP_NeurIPS2021 copied to clipboard
Error When Generating Channel Independence
First, I appreciate your insightful work.
But when runing the code python calculate_ci.py --arch resnet_56 --repeat 5 --num_layers 55
, I encounter the following error:
Traceback (most recent call last): File "/CHIP_NeurIPS2021/calculate_ci.py", line 91, in
main() File "/CHIP_NeurIPS2021/calculate_ci.py", line 81, in main ci = mean_repeat_ci(repeat, num_layers) File "/CHIP_NeurIPS2021/calculate_ci.py", line 75, in mean_repeat_ci return np.array(layer_ci_mean_total) ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (55,) + in homogeneous part.
I followed the instructions in the README.md. Could you please help me to address this error?
The occurrence of this issue is due to the attempt in the original code to convert lists with different dimensions into numpy arrays. This problem can be resolved by making the following modifications as shown below. I hope this is helpful to you.
Simply return 'layer_ci_mean_total' directly in the 'mean_repeat_ci' function, and in the 'main' function, use 'np.save(save_path + "/ci_conv{0}.npy".format(str(i + 1)), ci[i])' to save it.