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

Add ModelInputWrapper class to feed inputs to pytorch modules for layer methods #534

Closed

Conversation

miguelmartin75
Copy link
Contributor

Summary:
Introduces a utility class called ModelInputWrapper to wrap over a model in order to treat inputs as separate layers.

This does so by mapping each input fed to forward using an Identity operation. This way if attribute_to_inputs=True or False it should work.

Add two tests:

  • Test whether _foward_layer_eval retrieves the appropriate input values
  • Compare regular IG with layer IG and layer wrapped inputs

Differential Revision: D25110896

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D25110896

@miguelmartin75 miguelmartin75 changed the title add input wrapper for layer methods Add ModelInputWrapper class to feed inputs to pytorch modules for layer methods Nov 20, 2020
miguelmartin75 added a commit to miguelmartin75/captum that referenced this pull request Dec 8, 2020
Summary:
Pull Request resolved: pytorch#534

Introduces a utility class called `ModelInputWrapper` to wrap over a model in order to treat inputs as separate layers.

This does so by mapping each input fed to `forward` using an `Identity` operation. This way if attribute_to_inputs=True or False it should work.

Add two tests:
- Test whether _foward_layer_eval retrieves the appropriate input values
- Compare regular IG with layer IG and layer wrapped inputs

Updated tutorial and documentation

Differential Revision: D25110896

fbshipit-source-id: c46f1f720132edc674ccc12a2268ddb68b6d9af8
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D25110896

miguelmartin75 added a commit to miguelmartin75/captum that referenced this pull request Dec 8, 2020
Summary:
Pull Request resolved: pytorch#534

Introduces a utility class called `ModelInputWrapper` to wrap over a model in order to treat inputs as separate layers.

This does so by mapping each input fed to `forward` using an `Identity` operation. This way if attribute_to_inputs=True or False it should work.

Add two tests:
- Test whether _foward_layer_eval retrieves the appropriate input values
- Compare regular IG with layer IG and layer wrapped inputs

Updated tutorial and documentation

Differential Revision: D25110896

fbshipit-source-id: cffb280e58f29725c5115c9088160bdeedf58ef3
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D25110896

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D25110896

miguelmartin75 added a commit to miguelmartin75/captum that referenced this pull request Dec 8, 2020
Summary:
Pull Request resolved: pytorch#534

Introduces a utility class called `ModelInputWrapper` to wrap over a model in order to treat inputs as separate layers.

This does so by mapping each input fed to `forward` using an `Identity` operation. This way if attribute_to_inputs=True or False it should work.

Add two tests:
- Test whether _foward_layer_eval retrieves the appropriate input values
- Compare regular IG with layer IG and layer wrapped inputs

Updated tutorial and documentation

Differential Revision: D25110896

fbshipit-source-id: 1f640f0ad90f02829c1f7afdd1d6c167323ec92a
miguelmartin75 added a commit to miguelmartin75/captum that referenced this pull request Dec 9, 2020
Summary:
Pull Request resolved: pytorch#534

Introduces a utility class called `ModelInputWrapper` to wrap over a model in order to treat inputs as separate layers.

This does so by mapping each input fed to `forward` using an `Identity` operation. This way if attribute_to_inputs=True or False it should work.

Add two tests:
- Test whether _foward_layer_eval retrieves the appropriate input values
- Compare regular IG with layer IG and layer wrapped inputs

Updated tutorial and documentation

Differential Revision: D25110896

fbshipit-source-id: 7a28a719e1a403f507650d454272be2caba3624c
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D25110896

miguelmartin75 added a commit to miguelmartin75/captum that referenced this pull request Dec 9, 2020
Summary:
Pull Request resolved: pytorch#534

Introduces a utility class called `ModelInputWrapper` to wrap over a model in order to treat inputs as separate layers.

This does so by mapping each input fed to `forward` using an `Identity` operation. This way if attribute_to_inputs=True or False it should work.

Add two tests:
- Test whether _foward_layer_eval retrieves the appropriate input values
- Compare regular IG with layer IG and layer wrapped inputs

Updated tutorial and documentation

Differential Revision: D25110896

fbshipit-source-id: 3976e3a9d2251523b8255a85e190916e8f5a6ca4
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D25110896

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D25110896

miguelmartin75 added a commit to miguelmartin75/captum that referenced this pull request Dec 10, 2020
Summary:
Pull Request resolved: pytorch#534

Introduces a utility class called `ModelInputWrapper` to wrap over a model in order to treat inputs as separate layers.

This does so by mapping each input fed to `forward` using an `Identity` operation. This way if attribute_to_inputs=True or False it should work.

Add two tests:
- Test whether _foward_layer_eval retrieves the appropriate input values
- Compare regular IG with layer IG and layer wrapped inputs

Updated tutorial and documentation

Differential Revision: D25110896

fbshipit-source-id: c5e4d82895d26b302d55d1785f26ae3b194ae9d2
miguelmartin75 added a commit to miguelmartin75/captum that referenced this pull request Dec 11, 2020
Summary:
Pull Request resolved: pytorch#534

Introduces a utility class called `ModelInputWrapper` to wrap over a model in order to treat inputs as separate layers.

This does so by mapping each input fed to `forward` using an `Identity` operation. This way if attribute_to_inputs=True or False it should work.

Add two tests:
- Test whether _foward_layer_eval retrieves the appropriate input values
- Compare regular IG with layer IG and layer wrapped inputs

Updated tutorial and documentation

Differential Revision: D25110896

fbshipit-source-id: 51ae4c2fda32f12d5c23bb0d278ed284b0288347
miguelmartin75 added a commit to miguelmartin75/captum that referenced this pull request Dec 11, 2020
Summary:
Pull Request resolved: pytorch#534

Introduces a utility class called `ModelInputWrapper` to wrap over a model in order to treat inputs as separate layers.

This does so by mapping each input fed to `forward` using an `Identity` operation. This way if attribute_to_inputs=True or False it should work.

Add two tests:
- Test whether _foward_layer_eval retrieves the appropriate input values
- Compare regular IG with layer IG and layer wrapped inputs

Updated tutorial and documentation

Differential Revision: D25110896

fbshipit-source-id: 1744f083a0188b5dc54d93d2d210113b28acf233
miguelmartin75 added a commit to miguelmartin75/captum that referenced this pull request Dec 11, 2020
Summary:
Pull Request resolved: pytorch#534

Introduces a utility class called `ModelInputWrapper` to wrap over a model in order to treat inputs as separate layers.

This does so by mapping each input fed to `forward` using an `Identity` operation. This way if attribute_to_inputs=True or False it should work.

Add two tests:
- Test whether _foward_layer_eval retrieves the appropriate input values
- Compare regular IG with layer IG and layer wrapped inputs

Updated tutorial and documentation

Differential Revision: D25110896

fbshipit-source-id: 1d951bf06510aab85f83d4484ed8fabb724356c5
miguelmartin75 added a commit to miguelmartin75/captum that referenced this pull request Dec 11, 2020
Summary:
Pull Request resolved: pytorch#534

Introduces a utility class called `ModelInputWrapper` to wrap over a model in order to treat inputs as separate layers.

This does so by mapping each input fed to `forward` using an `Identity` operation. This way if attribute_to_inputs=True or False it should work.

Add two tests:
- Test whether _foward_layer_eval retrieves the appropriate input values
- Compare regular IG with layer IG and layer wrapped inputs

Updated tutorial and documentation

Differential Revision: D25110896

fbshipit-source-id: e71d520d5984b7d046ac5ab0b658d367398cf53b
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D25110896

Summary:
Pull Request resolved: pytorch#534

Introduces a utility class called `ModelInputWrapper` to wrap over a model in order to treat inputs as separate layers.

This does so by mapping each input fed to `forward` using an `Identity` operation. This way if attribute_to_inputs=True or False it should work.

Add two tests:
- Test whether _foward_layer_eval retrieves the appropriate input values
- Compare regular IG with layer IG and layer wrapped inputs

Updated tutorial and documentation

Reviewed By: NarineK

Differential Revision: D25110896

fbshipit-source-id: 82b6a4c335904833089b6c0e731d4fdd716163a2
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D25110896

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 174ecbd.

vivekmig pushed a commit that referenced this pull request Jan 21, 2021
Summary:
Pull Request resolved: #534

Introduces a utility class called `ModelInputWrapper` to wrap over a model in order to treat inputs as separate layers.

This does so by mapping each input fed to `forward` using an `Identity` operation. This way if attribute_to_inputs=True or False it should work.

Add two tests:
- Test whether _foward_layer_eval retrieves the appropriate input values
- Compare regular IG with layer IG and layer wrapped inputs

Updated tutorial and documentation

Reviewed By: NarineK

Differential Revision: D25110896

fbshipit-source-id: bb8dd4947ae88e183af94c09cf906f9687fbe8ff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants