diff --git a/captum/attr/_core/dataloader_attr.py b/captum/attr/_core/dataloader_attr.py index 444db1ae3..60b1e4377 100644 --- a/captum/attr/_core/dataloader_attr.py +++ b/captum/attr/_core/dataloader_attr.py @@ -369,6 +369,9 @@ def attribute( assert len(input_roles) == len(inputs), ( "input_roles must have the same size as the return of the dataloader,", f"length of input_roles is {len(input_roles)} ", + # pyre-fixme[6]: For 1st argument expected + # `pyre_extensions.ReadOnly[Sized]` but got + # `Optional[typing.Tuple[typing.Any, ...]]`. f"whereas the length of dataloader return is {len(inputs)}", ) @@ -395,6 +398,9 @@ def attribute( "Baselines must have the same size as the return of the dataloader ", "that need attribution", f"length of baseline is {len(baselines)} ", + # pyre-fixme[6]: For 1st argument expected + # `pyre_extensions.ReadOnly[Sized]` but got + # `Optional[typing.Tuple[typing.Any, ...]]`. f'whereas the length of dataloader return with role "0" is {len(inputs)}', ) @@ -413,6 +419,9 @@ def attribute( "Feature mask must have the same size as the return of the dataloader ", "that need attribution", f"length of feature_mask is {len(feature_mask)} ", + # pyre-fixme[6]: For 1st argument expected + # `pyre_extensions.ReadOnly[Sized]` but got + # `Optional[typing.Tuple[typing.Any, ...]]`. f'whereas the length of dataloader return with role "0" is {len(inputs)}', ) diff --git a/captum/attr/_core/deep_lift.py b/captum/attr/_core/deep_lift.py index 0a127caf2..e03437fb3 100644 --- a/captum/attr/_core/deep_lift.py +++ b/captum/attr/_core/deep_lift.py @@ -833,6 +833,9 @@ def attribute( # type: ignore " with more than one example but found: {}." " If baselines are provided in shape of scalars or with a single" " baseline example, `DeepLift`" + # pyre-fixme[16]: Item `Callable` of `Union[(...) -> + # TensorOrTupleOfTensorsGeneric, TensorOrTupleOfTensorsGeneric]` has no + # attribute `__getitem__`. " approach can be used instead.".format(baselines[0]) ) diff --git a/captum/attr/_core/gradient_shap.py b/captum/attr/_core/gradient_shap.py index feb162173..c179633ae 100644 --- a/captum/attr/_core/gradient_shap.py +++ b/captum/attr/_core/gradient_shap.py @@ -275,6 +275,9 @@ def attribute( # attribute `__getitem__`. assert isinstance(baselines[0], torch.Tensor), ( "Baselines distribution has to be provided in a form " + # pyre-fixme[16]: Item `Callable` of `Union[(...) -> + # TensorOrTupleOfTensorsGeneric, TensorOrTupleOfTensorsGeneric]` has no + # attribute `__getitem__`. "of a torch.Tensor {}.".format(baselines[0]) ) diff --git a/captum/attr/_core/layer/layer_gradient_shap.py b/captum/attr/_core/layer/layer_gradient_shap.py index 171f1e9ad..c2d659aee 100644 --- a/captum/attr/_core/layer/layer_gradient_shap.py +++ b/captum/attr/_core/layer/layer_gradient_shap.py @@ -308,6 +308,8 @@ def attribute( # TensorOrTupleOfTensorsGeneric]` has no attribute `__getitem__`. assert isinstance(baselines[0], torch.Tensor), ( "Baselines distribution has to be provided in a form " + # pyre-fixme[16]: Item `Callable` of `Union[(...) -> Any, + # TensorOrTupleOfTensorsGeneric]` has no attribute `__getitem__`. "of a torch.Tensor {}.".format(baselines[0]) ) diff --git a/captum/attr/_utils/attribution.py b/captum/attr/_utils/attribution.py index c8a628cdc..cf02fd3c0 100644 --- a/captum/attr/_utils/attribution.py +++ b/captum/attr/_utils/attribution.py @@ -43,6 +43,7 @@ def __init__(self, forward_func: Callable) -> None: self.forward_func = forward_func # pyre-fixme[24]: Generic type `Callable` expects 2 type parameters. + # pyre-fixme[13]: Attribute `attribute` is never initialized. attribute: Callable r""" This method computes and returns the attribution values for each input tensor. @@ -74,6 +75,7 @@ def __init__(self, forward_func: Callable) -> None: """ # pyre-fixme[24] Generic type `Callable` expects 2 type parameters. + # pyre-fixme[13]: Attribute `attribute_future` is never initialized. attribute_future: Callable r""" @@ -126,6 +128,7 @@ def has_convergence_delta(self) -> bool: return False # pyre-fixme[24]: Generic type `Callable` expects 2 type parameters. + # pyre-fixme[13]: Attribute `compute_convergence_delta` is never initialized. compute_convergence_delta: Callable r""" The attribution algorithms which derive `Attribution` class and provide @@ -504,6 +507,7 @@ def __init__( InternalAttribution.__init__(self, forward_func, layer, device_ids) # pyre-fixme[24]: Generic type `Callable` expects 2 type parameters. + # pyre-fixme[13]: Attribute `attribute` is never initialized. attribute: Callable r""" This method computes and returns the neuron attribution values for each diff --git a/captum/concept/_core/concept.py b/captum/concept/_core/concept.py index 275265384..dfa8e1a80 100644 --- a/captum/concept/_core/concept.py +++ b/captum/concept/_core/concept.py @@ -74,6 +74,7 @@ def __init__(self, model: Module) -> None: self.model = model # pyre-fixme[24]: Generic type `Callable` expects 2 type parameters. + # pyre-fixme[13]: Attribute `interpret` is never initialized. interpret: Callable r""" An abstract interpret method that performs concept-based model interpretability diff --git a/captum/robust/_core/metrics/min_param_perturbation.py b/captum/robust/_core/metrics/min_param_perturbation.py index 46f8be5c0..1c2d32fae 100644 --- a/captum/robust/_core/metrics/min_param_perturbation.py +++ b/captum/robust/_core/metrics/min_param_perturbation.py @@ -21,8 +21,12 @@ def drange( min_val: Union[int, float], max_val: Union[int, float], step_val: Union[int, float] ) -> Generator[Union[int, float], None, None]: curr = min_val + # pyre-fixme[58]: `>` is not supported for operand types `Union[float, int]` and + # `int`. while curr < max_val: yield curr + # pyre-fixme[58]: `+` is not supported for operand types `Union[float, int]` + # and `Union[float, int]`. curr += step_val diff --git a/captum/robust/_core/perturbation.py b/captum/robust/_core/perturbation.py index 0e4b037d0..c90f7ac0a 100644 --- a/captum/robust/_core/perturbation.py +++ b/captum/robust/_core/perturbation.py @@ -12,6 +12,7 @@ class Perturbation: """ # pyre-fixme[24]: Generic type `Callable` expects 2 type parameters. + # pyre-fixme[13]: Attribute `perturb` is never initialized. perturb: Callable r""" This method computes and returns the perturbed input for each input tensor.