Skip to content

Commit 65fd1fa

Browse files
Vivek Miglanifacebook-github-bot
authored andcommitted
Fix get_config_util pyre fixme issues
Summary: Fixing unresolved pyre fixme issues in corresponding file Differential Revision: D76737143
1 parent 1a07286 commit 65fd1fa

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

captum/testing/attr/helpers/get_config_util.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
22

33
# pyre-strict
4-
from typing import Any, Tuple
4+
from typing import List, Tuple
55

66
import torch
77
from captum._utils.gradient import compute_gradients
@@ -10,17 +10,15 @@
1010
from torch.nn import Module
1111

1212

13-
# pyre-fixme[3]: Return annotation cannot contain `Any`.
14-
def get_basic_config() -> Tuple[Module, Tensor, Tensor, Any]:
13+
def get_basic_config() -> Tuple[Module, Tensor, Tensor, None]:
1514
input = torch.tensor([1.0, 2.0, 3.0, 0.0, -1.0, 7.0], requires_grad=True).T
1615
# manually percomputed gradients
1716
grads = torch.tensor([-0.0, -0.0, -0.0, 1.0, 1.0, -0.0])
1817
return BasicModel(), input, grads, None
1918

2019

21-
# pyre-fixme[3]: Return annotation cannot contain `Any`.
2220
def get_multiargs_basic_config() -> (
23-
Tuple[Module, Tuple[Tensor, ...], Tuple[Tensor, ...], Any]
21+
Tuple[Module, Tuple[Tensor, ...], Tuple[Tensor, ...], Tuple[List[int], int]]
2422
):
2523
model = BasicModel5_MultiArgs()
2624
additional_forward_args = ([2, 3], 1)
@@ -34,9 +32,8 @@ def get_multiargs_basic_config() -> (
3432
return model, inputs, grads, additional_forward_args
3533

3634

37-
# pyre-fixme[3]: Return annotation cannot contain `Any`.
3835
def get_multiargs_basic_config_large() -> (
39-
Tuple[Module, Tuple[Tensor, ...], Tuple[Tensor, ...], Any]
36+
Tuple[Module, Tuple[Tensor, ...], Tuple[Tensor, ...], Tuple[List[int], int]]
4037
):
4138
model = BasicModel5_MultiArgs()
4239
additional_forward_args = ([2, 3], 1)

0 commit comments

Comments
 (0)