Skip to content
Merged
Show file tree
Hide file tree
Changes from 139 commits
Commits
Show all changes
166 commits
Select commit Hold shift + click to select a range
f0cd62f
Fix objectives, images and misc code
greentfrapp Dec 8, 2020
ac61808
Lint
greentfrapp Dec 8, 2020
a88a468
Update RedirectedReLU
greentfrapp Dec 8, 2020
4262a1b
Merge latest optim-wip
greentfrapp Dec 9, 2020
a84d9a5
Merge branch 'pytorch-optim-wip' into optim-wip-objectives-images
greentfrapp Dec 9, 2020
f34044b
Fix RedirectedReLU
greentfrapp Dec 9, 2020
2c8c7d7
Lint
greentfrapp Dec 9, 2020
fd403a3
Move torch.fft import for backward compatibility
greentfrapp Dec 9, 2020
6251d14
Fix align_corners parameter for backward compatibility
greentfrapp Dec 9, 2020
8a03ec2
Bug fix for objectives due to new ImageTensor
greentfrapp Dec 12, 2020
a37ae08
Add loss composition
greentfrapp Dec 12, 2020
2d97739
Move optim tutorials to optim folder
greentfrapp Dec 12, 2020
64b91ab
Add __pow__
greentfrapp Dec 15, 2020
7a68684
Merge latest optim-wip
greentfrapp Jan 1, 2021
4be77ad
Merge branch 'pytorch-optim-wip' into optim-wip-objectives-images
greentfrapp Jan 1, 2021
5807f3c
Fix lint
greentfrapp Jan 1, 2021
7d9cf54
Merge branch 'optim-wip' into optim-wip-objectives-images
greentfrapp Jan 4, 2021
302151f
Additional fixes after merge
greentfrapp Jan 4, 2021
476c158
Fix bug in L2 calculation
greentfrapp Jan 24, 2021
147b24d
Fix args and kwargs in InputOptimization
greentfrapp Jan 24, 2021
d8643d9
Add tests for loss, objectives and images
greentfrapp Jan 24, 2021
c280fd0
Fix InputOptimization test
greentfrapp Jan 24, 2021
4a97917
Fix lint
greentfrapp Jan 24, 2021
05b68de
Fix test_progress
greentfrapp Jan 24, 2021
d5a8a39
Skip some tests for torch==1.2.0
greentfrapp Jan 24, 2021
b1ad784
Add missing torch import
greentfrapp Jan 24, 2021
948be8d
Merge branch 'optim-wip' into optim-wip-objectives-images
greentfrapp Jan 28, 2021
4196735
Initialize SimpleModel weights for better reproducibility
greentfrapp Jan 28, 2021
ed2d33c
Fix bare except
greentfrapp Jan 28, 2021
580733c
Add supports_gpu arg to ChannelReducer
greentfrapp Jan 29, 2021
b0c8a2c
Switch ImageTensor to inherit from nn.Parameter
greentfrapp Feb 2, 2021
cd62aa7
Fix lint
greentfrapp Feb 2, 2021
f54ed45
Fix ImageTensor
greentfrapp Feb 2, 2021
9eb37b7
Add default empty value for ImageTensor
greentfrapp Feb 2, 2021
7c918f6
Add transforms from @ProGamerGov
greentfrapp Feb 6, 2021
488e2bc
Remove unittest.main from optim tests
greentfrapp Feb 10, 2021
5e1a800
Use collect_activations in test_loss
greentfrapp Feb 10, 2021
b8dd499
Use assertTrue instead of assert
greentfrapp Feb 10, 2021
7f0cef0
Move self.cleanup to `finally` block
greentfrapp Feb 10, 2021
cec5b1a
Rely on parent for self.target=target
greentfrapp Feb 10, 2021
36492d0
Truncate too big arg instead of not showing
greentfrapp Feb 10, 2021
2071063
Add assert checks for AlphaChannelLoss
greentfrapp Feb 10, 2021
dece597
Check for torch version instead of doing try except in get_fft_funcs
greentfrapp Feb 10, 2021
c0c9e13
Change torch.__version__ == "1.2.0" to <= "1.2.0"
greentfrapp Feb 10, 2021
62376e8
Remove tutorials/optim
greentfrapp Feb 10, 2021
1658278
Remove unused imports
greentfrapp Feb 10, 2021
3e5ebfd
Move torch.__version__ out
greentfrapp Feb 10, 2021
6a487f8
Hardcode superclass Loss because we are using a wrapper
greentfrapp Feb 10, 2021
bf0560f
Lint fix
greentfrapp Feb 10, 2021
dadbc71
Fix incorrect check for torch version
greentfrapp Feb 10, 2021
d97b8aa
Check torch.__version__ for passing align_corners
greentfrapp Feb 11, 2021
d49fcd0
Move test model to helpers.basic_models
greentfrapp Feb 11, 2021
a21d459
Merge branch 'optim-wip' into optim-wip-objectives-images
greentfrapp Feb 11, 2021
7c9c636
Add cuda test for ImageTensor
greentfrapp Feb 11, 2021
eca3a0f
Lint fix
greentfrapp Feb 11, 2021
30d662a
Add tests for TypeError in CompositeLoss
greentfrapp Feb 11, 2021
a5d5c72
Move show and export functions to optim._utils.image.common
greentfrapp Feb 11, 2021
bb60940
Enforce target property in Loss subclasses
greentfrapp Feb 11, 2021
bb61e13
Update tutorials to use new InputOptimization
greentfrapp Feb 11, 2021
3610764
Fix AlmostEqual tests in optim/test_loss
greentfrapp Feb 11, 2021
8b26b0b
Fix several tests
greentfrapp Feb 11, 2021
a18b6cb
Use less strict test for InputOptimization
greentfrapp Feb 11, 2021
02a99fa
Remove unnecessary except statement
greentfrapp Feb 12, 2021
83b2b35
Add tests for ChannelReducer
greentfrapp Feb 12, 2021
dfd368c
Lint fix
greentfrapp Feb 12, 2021
da65e79
Update objectives.py to optimization.py
greentfrapp Mar 22, 2021
6c86d1d
Fix tests
greentfrapp Mar 22, 2021
6ac8fe5
Fix composite losses
greentfrapp Mar 22, 2021
ae14a3a
Fix documentation and remove unused function
greentfrapp Mar 22, 2021
f08194e
Lint fix
greentfrapp Mar 22, 2021
30ad997
Lint fix
greentfrapp Mar 22, 2021
56a8778
Add typehints
greentfrapp Mar 22, 2021
00a6707
Add optional batch_index to losses
greentfrapp Mar 22, 2021
df0f586
Update tutorials
greentfrapp Mar 22, 2021
255c459
Change rand_select to _rand_select
greentfrapp Mar 22, 2021
bf7a6a0
Fix tests
greentfrapp Mar 22, 2021
48f2149
Fix tests
greentfrapp Mar 23, 2021
cf29b6d
Update batch_index in losses
greentfrapp Mar 25, 2021
52f03a4
Use torch ReLU and LocalResponseNorm instead of custom layers
greentfrapp Mar 25, 2021
f2d9002
Remove warnings from notebooks
greentfrapp Mar 25, 2021
cfec15e
Add summarize_loss
greentfrapp Mar 25, 2021
237ffab
Remove supports_gpu arg and raise more informative error if TypeError…
greentfrapp Mar 25, 2021
1c73a2d
Lint fix
greentfrapp Mar 25, 2021
ce6dc54
Add CUDA test for ImageTensor
greentfrapp Mar 25, 2021
eff57aa
Fix ImageTensor CUDA test
greentfrapp Mar 25, 2021
24cabcd
Remove if statement from RedirectedReluLayer
greentfrapp Mar 26, 2021
b5b7e2c
Remove unnecessary device variable
greentfrapp Mar 26, 2021
4c89e8f
Add typehint for module_op
greentfrapp Mar 26, 2021
ca81f23
Fix bugs in tutorials
greentfrapp Mar 26, 2021
848bcff
Add todo note to Conv2dSame
greentfrapp Mar 26, 2021
a3bd393
Make WeightVisualization tutorial CUDA-compatible
greentfrapp Mar 26, 2021
5832e36
Lint fix
greentfrapp Mar 26, 2021
3fdc801
Add typehints for math ops
greentfrapp Mar 26, 2021
c37cc14
Fix typehints
greentfrapp Mar 26, 2021
2fd8f8e
Use forward declaration for typehints
greentfrapp Mar 26, 2021
ee912a2
Update notebooks
greentfrapp Mar 26, 2021
e7b7720
Restructure models folder and add inception5h classes
greentfrapp Mar 27, 2021
2fdbf49
Expose RedirectedReluLayer via optim.models
greentfrapp Mar 27, 2021
bb7f466
Lint fix
greentfrapp Mar 27, 2021
c78eba7
Use independent random inits for each image in batch
greentfrapp Mar 27, 2021
19b90ab
Add more tests
greentfrapp Mar 27, 2021
30d1104
Lint fix
greentfrapp Mar 27, 2021
ecdd801
Update googlenet import in tutorials
greentfrapp Mar 27, 2021
6257f73
Remove extra print statement
greentfrapp Mar 27, 2021
46e479c
Small change to wording in tutorial
greentfrapp Mar 27, 2021
c67c889
Set default param to same device as model for optimization
greentfrapp Mar 27, 2021
d89d58b
Add notebook for reproducing Lucid tutorial
greentfrapp Mar 27, 2021
1c055eb
Move ReLU out of InceptionModule
greentfrapp Mar 27, 2021
d0c5a04
Remove extra code in CompositeLoss tutorial
greentfrapp Mar 27, 2021
2839976
Small fix for CompositeLoss tutorial
greentfrapp Mar 27, 2021
9d5c5cb
Fix Diversity loss
greentfrapp Mar 27, 2021
ee8465f
Add Interpolation tutorial
greentfrapp Mar 27, 2021
0704af6
Add negative sign to Alignment loss
greentfrapp Mar 28, 2021
ef8d147
Set AlphaChannelLoss as ToDo
greentfrapp Mar 28, 2021
d85f4e5
Rename SimpleLoss to BaseLoss and add batch_index to CustomModules
greentfrapp Mar 28, 2021
0fc0de9
Add typehint to default_loss_summarize and add to CustomModules tutorial
greentfrapp Mar 28, 2021
66744cc
Fix small bug in CustomModules batch_index
greentfrapp Mar 28, 2021
a82070c
Add typehint to InceptionModule
greentfrapp Mar 28, 2021
2b5ad0d
Add typehint to AuxBranch
greentfrapp Mar 28, 2021
229e1aa
Update and combine tutorials
greentfrapp Mar 29, 2021
d7e6ef2
Expose skip_layers in optim.models
greentfrapp Mar 29, 2021
9f8c9fa
Fix conflict
greentfrapp Mar 30, 2021
5f5ceb0
Resolve conflicts
greentfrapp Mar 30, 2021
443b796
Merge branch 'pytorch-optim-wip' into optim-wip-objectives-images
greentfrapp Mar 30, 2021
ec1a79b
Fix bug from resolving conflicts
greentfrapp Mar 30, 2021
322f882
Refactor __init__ files
greentfrapp Mar 30, 2021
f652f79
Move lr arg to optimize and add typehints for InputOptimization methods
greentfrapp Mar 30, 2021
65b66dc
Add description to default_loss_summarize
greentfrapp Mar 30, 2021
140d62d
Update tutorials
greentfrapp Mar 30, 2021
f0f9a7d
Update __init__
greentfrapp Mar 31, 2021
0e6fa8f
Restructure submodules
greentfrapp Apr 1, 2021
24379d5
Lint and update tests
greentfrapp Apr 1, 2021
aab4c80
Expose inception5h classes via optim.models.INCEPTION5H_CLASSES
greentfrapp Apr 1, 2021
fa44939
Lint fix
greentfrapp Apr 1, 2021
93cb190
Add ChannelAttribution tutorial
greentfrapp Apr 1, 2021
3c03173
Clean up notebooks
greentfrapp Apr 1, 2021
1cac260
Remove Neuron Groups
greentfrapp Apr 1, 2021
6b7ff8c
Update submodule folder structure
greentfrapp Apr 3, 2021
9596e28
Add __all__ to submodule files
greentfrapp Apr 4, 2021
3bb726d
Expose loss_wrapper in losses.py
greentfrapp Apr 5, 2021
b4064ee
Remove warnings import
greentfrapp Apr 5, 2021
6e3ea9c
Add typehints
greentfrapp Apr 6, 2021
05c3518
Add and fix typehints
greentfrapp Apr 7, 2021
33c5da6
Add typehints to tutorials
greentfrapp Apr 7, 2021
1156f7a
Remove str from device type
greentfrapp Apr 7, 2021
4d954a6
Lint fix
greentfrapp Apr 7, 2021
c3cea2e
Remove AvgPool2dConstrained
greentfrapp Apr 8, 2021
a506d90
Remove unused tests and lint
greentfrapp Apr 8, 2021
3fe9102
Add check for AvgPool2d
greentfrapp Apr 8, 2021
9bfb477
Add note on loss_wrapper
greentfrapp Apr 9, 2021
53b873c
Add typehints and other small fixes
greentfrapp Apr 9, 2021
4cdce41
More typehints and add weight banding article reference
greentfrapp Apr 10, 2021
35db053
Fix typo in test
greentfrapp Apr 10, 2021
c91256a
Fix weird mypy error
greentfrapp Apr 10, 2021
1ab9397
Fix small bug in pad and show
greentfrapp Apr 12, 2021
a1fcdf8
Fix _dot_cossim function
greentfrapp Apr 12, 2021
c40e6db
Move _dot_cossim to common.py
greentfrapp Apr 12, 2021
f591157
Lint fix
greentfrapp Apr 12, 2021
d6fa517
Change AbortForwardException to warning
greentfrapp Apr 12, 2021
72ade8d
Add test for input-based optimization
greentfrapp Apr 13, 2021
e17569a
Use eps in _dot_cossim
greentfrapp Apr 13, 2021
af931a2
Fix nits and fix warning suppression
greentfrapp Apr 19, 2021
c4d2158
Remove unnecessary self.batch and use torch.fft.fftfreq
greentfrapp Apr 19, 2021
c97d180
Small fixes for FFTImage
greentfrapp Apr 24, 2021
78a82ae
Add missing Callable
greentfrapp Apr 24, 2021
bc744a3
Add back transforms
greentfrapp Apr 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 28 additions & 8 deletions captum/optim/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
"""optim submodule."""

from captum.optim._core import loss # noqa: F401
from captum.optim._core import objectives # noqa: F401
from captum.optim._core.objectives import InputOptimization # noqa: F401
from captum.optim._param.image import images # noqa: F401
from captum.optim._param.image import transform # noqa: F401
from captum.optim import models
from captum.optim._core import loss, optimization # noqa: F401
from captum.optim._core.optimization import InputOptimization # noqa: F401
from captum.optim._param.image import images, transforms # noqa: F401
from captum.optim._param.image.images import ImageTensor # noqa: F401
from captum.optim._utils import circuits, models, reducer # noqa: F401
from captum.optim._utils.image.common import nchannels_to_rgb # noqa: F401
from captum.optim._utils.image.common import weights_to_heatmap_2d # noqa: F401
from captum.optim._utils import circuits, reducer # noqa: F401
from captum.optim._utils.image.common import ( # noqa: F401
nchannels_to_rgb,
save_tensor_as_image,
show,
weights_to_heatmap_2d,
)
from captum.optim._utils.reducer import ChannelReducer, posneg # noqa: F401

__all__ = [
"InputOptimization",
"ImageTensor",
"loss",
"optimization",
"images",
"transforms",
"circuits",
"models",
"reducer",
"nchannels_to_rgb",
"save_tensor_as_image",
"show",
"weights_to_heatmap_2d",
]
Loading