albermax / albermax/innvestigate

allow_lambda_layers parameter not working for SmoothGrad and IntegratedGradients

Đang mở
#157 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
1.3k
Fork
230
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hi, I believe there may be an issue with SmoothGrad and IntegratedGradients methods when there's need to set `allow_lambda_layers=True` during the creation of the analyzer.

In particular I think that `"allow_lambda_layers"` is missing in `kwargs_keys` defined in the `__init__()` method of both classes `SmoothGrad` and `IntegratedGradient`, so it cannot be passed to the inner `Gradient` constructor for both methods.

A snippet of the code I use is the following (but the same happens for method "integrated_gradients"):
```python
analyzer = innvestigate.create_analyzer("smoothgrad", model, allow_lambda_layers=True)
analyzer.analyze(preprocessed_input)
```

while the stacktrace is:

```
Traceback (most recent call last):
File "/home/davide/PycharmProjects/innvestigate-gui/innvestigate-gui/main.py", line 890, in visualize
allow_lambda_layers=True)
File "/usr/local/lib/python3.6/dist-packages/innvestigate/analyzer/__init__.py", line 140, in create_analyzer
return analyzer_class(model, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/innvestigate/analyzer/gradient_based.py", line 310, in __init__
**kwargs)
File "/usr/local/lib/python3.6/dist-packages/innvestigate/analyzer/wrapper.py", line 219, in __init__
*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/innvestigate/analyzer/wrapper.py", line 97, in __init__
*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/innvestigate/analyzer/wrapper.py", line 49, in __init__
*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'allow_lambda_layers'
```

Among these 2 methods, with all the others creating the analyzer with `allow_lambda_layers=True` works correctly.

If you need any extra information let me know.
Thanks.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.