-
Notifications
You must be signed in to change notification settings - Fork 233
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
[BUG] Mutation warning being printed at every layer of EfficientNet when running LRP analyzer #324
Comments
It is because of the tf.compat.v1.disable_eager_execution(). I am working with EfficientNetV2B0 and the analyze method takes to much time to execute. Even worst on my side, using the following code: inn.create_analyzer("lrp.epsilon", model_wo_softmax,**{'epsilon':1}) returns an error related with LRP only supports convolutional layers (EfficientNetV2B0 has DepthwiseConv2D layers). I could execute LRP analysis with the following code: from innvestigate.analyzer import LRP But I had to do a change in the library code (file: relevance_analyzer.py; line:188): self._axis = axes_number_in_batch_normalization_layer #integer the original code is getting this value from config["axis"], but in EfficientnetV2B0 the value of config["axis"] is a list (i.e. 'axis': ListWrapper([3])). Of course, modifying the library code is not a good idea. |
Describe the bug
Running any LRP analyzer, I get tensorflow warnings in the format of something like:
2023-11-22 10:49:33.032371: W tensorflow/c/c_api.cc:305] Operation '{name:'mul_1355/x' id:43796 op device:{requested: '', assigned: ''} def:{{{node mul_1355/x}} = Const[_has_manual_control_dependencies=true, dtype=DT_FLOAT, value=Tensor<type: float shape: [] values: 1e-07>]()}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
Being printed at what looks to be every single layer in the EfficientNet model I'm using. It also runs very slowly, taking about 15 minutes (longer if I use the sequential presets) to analyze the model. Is this runtime normal due to the size of the network? Can I safely ignore these warnings or is something actually wrong?
Steps to reproduce the bug
NOTE: I had to implement juliowissing-iis's fix here for this code block to run without errors.
Expected behavior
Minimal mutation warnings and a code that doesn't take 15 minutes to run.
Platform information
The text was updated successfully, but these errors were encountered: