Skip to content

Commit

Permalink
Fix new mypy warnings (microsoft#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjstewart authored Dec 24, 2021
1 parent 5973b9b commit 630ba2c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions torchgeo/transforms/indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import torch
from torch import Tensor
from torch.nn import Module # type: ignore[attr-defined]
from torch.nn.modules import Module

# https://github.com/pytorch/pytorch/issues/60979
# https://github.com/pytorch/pytorch/pull/61045
Expand Down Expand Up @@ -90,7 +90,7 @@ def ndwi(green: Tensor, nir: Tensor) -> Tensor:
return (green - nir) / ((green + nir) + _EPSILON)


class AppendNDBI(Module): # type: ignore[misc,name-defined]
class AppendNDBI(Module):
"""Normalized Difference Built-up Index (NDBI).
If you use this dataset in your research, please cite the following paper:
Expand Down Expand Up @@ -132,7 +132,7 @@ def forward(self, sample: Dict[str, Tensor]) -> Dict[str, Tensor]:
return sample


class AppendNBR(Module): # type: ignore[misc,name-defined]
class AppendNBR(Module):
"""Normalized Burn Ratio (NBR).
.. versionadded:: 0.2.0
Expand Down Expand Up @@ -172,7 +172,7 @@ def forward(self, sample: Dict[str, Tensor]) -> Dict[str, Tensor]:
return sample


class AppendNDSI(Module): # type: ignore[misc,name-defined]
class AppendNDSI(Module):
"""Normalized Difference Snow Index (NDSI).
If you use this dataset in your research, please cite the following paper:
Expand Down Expand Up @@ -214,7 +214,7 @@ def forward(self, sample: Dict[str, Tensor]) -> Dict[str, Tensor]:
return sample


class AppendNDVI(Module): # type: ignore[misc,name-defined]
class AppendNDVI(Module):
"""Normalized Difference Vegetation Index (NDVI).
If you use this dataset in your research, please cite the following paper:
Expand Down Expand Up @@ -256,7 +256,7 @@ def forward(self, sample: Dict[str, Tensor]) -> Dict[str, Tensor]:
return sample


class AppendNDWI(Module): # type: ignore[misc,name-defined]
class AppendNDWI(Module):
"""Normalized Difference Water Index (NDWI).
If you use this dataset in your research, please cite the following paper:
Expand Down
4 changes: 2 additions & 2 deletions torchgeo/transforms/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
import kornia.augmentation as K
import torch
from torch import Tensor
from torch.nn import Module # type: ignore[attr-defined]
from torch.nn.modules import Module

# https://github.com/pytorch/pytorch/issues/60979
# https://github.com/pytorch/pytorch/pull/61045
Module.__module__ = "torch.nn"


class AugmentationSequential(Module): # type: ignore[misc]
class AugmentationSequential(Module):
"""Wrapper around kornia AugmentationSequential to handle input dicts."""

def __init__(self, *args: Module, data_keys: List[str]) -> None:
Expand Down

0 comments on commit 630ba2c

Please sign in to comment.