Skip to content

Commit

Permalink
Deprecate Conv2d, ConvTranspose2d and BatchNorm2d (#2244)
Browse files Browse the repository at this point in the history
* Deprecate Conv2d, ConvTranspose2d and BatchNorm

* Fix lint
  • Loading branch information
fmassa authored May 20, 2020
1 parent cb65590 commit 9055250
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions torchvision/ops/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,30 @@
from torchvision.ops import _new_empty_tensor


class Conv2d(torch.nn.Conv2d):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
warnings.warn(
"torchvision.ops.misc.Conv2d is deprecated and will be "
"removed in future versions, use torch.nn.Conv2d instead.", FutureWarning)


class ConvTranspose2d(torch.nn.ConvTranspose2d):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
warnings.warn(
"torchvision.ops.misc.ConvTranspose2d is deprecated and will be "
"removed in future versions, use torch.nn.ConvTranspose2d instead.", FutureWarning)


class BatchNorm2d(torch.nn.BatchNorm2d):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
warnings.warn(
"torchvision.ops.misc.BatchNorm2d is deprecated and will be "
"removed in future versions, use torch.nn.BatchNorm2d instead.", FutureWarning)


def _check_size_scale_factor(dim, size, scale_factor):
# type: (int, Optional[List[int]], Optional[float]) -> None
if size is None and scale_factor is None:
Expand Down

0 comments on commit 9055250

Please sign in to comment.