Skip to content

Commit b487891

Browse files
styusuffacebook-github-bot
authored andcommitted
Moving the Base Test Helper (#1485)
Summary: Pull Request resolved: #1485 moving the base test helper to the captum library. This has a lot of file dependency so apologies for the large Diff Reviewed By: cyrjano, lurunming Differential Revision: D68174196 fbshipit-source-id: 84f180748bd6c70cba1b7079a14e97e520228feb
1 parent 4b7879c commit b487891

File tree

93 files changed

+246
-217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+246
-217
lines changed

tests/helpers/__init__.py renamed to captum/testing/helpers/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# pyre-strict
44

55
try:
6-
from tests.helpers.fb.internal_base import FbBaseTest as BaseTest
6+
from captum.testing.helpers.fb.internal_base import FbBaseTest as BaseTest
77

88
__all__ = [
99
"BaseTest",
@@ -13,4 +13,4 @@
1313
# tests/helpers/__init__.py:13: error: Incompatible import of "BaseTest"
1414
# (imported name has type "type[BaseTest]", local name has type
1515
# "type[FbBaseTest]") [assignment]
16-
from tests.helpers.basic import BaseTest # type: ignore
16+
from captum.testing.helpers.basic import BaseTest # type: ignore
File renamed without changes.

tests/attr/helpers/attribution_delta_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from typing import Tuple, Union
55

66
import torch
7-
from tests.helpers import BaseTest
7+
from captum.testing.helpers import BaseTest
88
from torch import Tensor
99

1010

tests/attr/helpers/get_config_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import torch
77
from captum._utils.gradient import compute_gradients
8-
from tests.helpers.basic_models import BasicModel, BasicModel5_MultiArgs
8+
from captum.testing.helpers.basic_models import BasicModel, BasicModel5_MultiArgs
99
from torch import Tensor
1010
from torch.nn import Module
1111

tests/attr/helpers/test_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
from captum.attr._core.saliency import Saliency
4141
from captum.attr._core.shapley_value import ShapleyValueSampling
4242
from captum.attr._utils.input_layer_wrapper import ModelInputWrapper
43-
from tests.helpers.basic import set_all_random_seeds
44-
from tests.helpers.basic_models import (
43+
from captum.testing.helpers.basic import set_all_random_seeds
44+
from captum.testing.helpers.basic_models import (
4545
BasicModel_ConvNet,
4646
BasicModel_MultiLayer,
4747
BasicModel_MultiLayer_MultiInput,

tests/attr/layer/test_grad_cam.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
import torch
99
from captum._utils.typing import TensorLikeList
1010
from captum.attr._core.layer.grad_cam import LayerGradCam
11-
from packaging import version
12-
from tests.helpers import BaseTest
13-
from tests.helpers.basic import assertTensorTuplesAlmostEqual
14-
from tests.helpers.basic_models import (
11+
from captum.testing.helpers import BaseTest
12+
from captum.testing.helpers.basic import assertTensorTuplesAlmostEqual
13+
from captum.testing.helpers.basic_models import (
1514
BasicModel_ConvNet_One_Conv,
1615
BasicModel_MultiLayer,
1716
)
17+
from packaging import version
1818
from torch import Tensor
1919
from torch.nn import Module
2020

tests/attr/layer/test_internal_influence.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
import torch
88
from captum._utils.typing import BaselineType
99
from captum.attr._core.layer.internal_influence import InternalInfluence
10-
from packaging import version
11-
from tests.helpers.basic import assertTensorTuplesAlmostEqual, BaseTest
12-
from tests.helpers.basic_models import (
10+
from captum.testing.helpers.basic import assertTensorTuplesAlmostEqual, BaseTest
11+
from captum.testing.helpers.basic_models import (
1312
BasicModel_MultiLayer,
1413
BasicModel_MultiLayer_MultiInput,
1514
)
15+
from packaging import version
1616
from torch import Tensor
1717
from torch.nn import Module
1818

0 commit comments

Comments
 (0)