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

[BUG] NotImplementedError raised every time layers are checked with _do_model_checks() for analyzers inheriting from AnalyzerBase #323

Open
juliowissing-iis opened this issue Oct 13, 2023 · 0 comments
Labels
triage Bug report that needs assessment

Comments

@juliowissing-iis
Copy link

Describe the bug

When creating an analyzer that uses model checks (e.g., LRPSequentialPresetA), a NotImplementedError is raised for every check that should only be a warning. This originates from the snippet (lines 120-125 in analyzer/base.py):

if check_type == "exception":
    raise NotAnalyzeableModelException(tmp_message)
if check_type == "warning":
    # TODO(albermax) only the first warning will be shown
    warnings.warn(tmp_message)
raise NotImplementedError()

Steps to reproduce the bug

import tensorflow as tf
import innvestigate
tf.compat.v1.disable_eager_execution()

model = _   # create model with non-ReLU activation
analyzer = innvestigate.analyzer.LRPSequentialPresetA(model)

Expected behavior

As LRPSequentialPresetA only has a check with check_type "warning" no exception should be raised, just a warning. To fix this I changed the abovementioned snippet to:

if check_type == "exception":
    raise NotAnalyzeableModelException(tmp_message)
elif check_type == "warning":
    # TODO(albermax) only the first warning will be shown
    warnings.warn(tmp_message)
else: 
    raise NotImplementedError("Check type {} unkown".format(check_type))

Platform information

  • OS: MacOS 13.6
  • Python version: 3.11.5
  • iNNvestigate version: 2.1.1
  • TensorFlow version: 2.13.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Bug report that needs assessment
Projects
None yet
Development

No branches or pull requests

1 participant