summaryrefslogtreecommitdiff
path: root/models/layers.py
diff options
context:
space:
mode:
authorJordan Gong <jordan.gong@protonmail.com>2021-01-07 19:55:00 +0800
committerJordan Gong <jordan.gong@protonmail.com>2021-01-07 19:55:00 +0800
commit98b6e6dc3be6f88abb72e351c8f2da2b23b8ab85 (patch)
tree05f690b2411acae88ae81bb716703dcab4557842 /models/layers.py
parent4a284084c253b9114fc02e1782962556ff113761 (diff)
Type hint for python version lower than 3.9
Diffstat (limited to 'models/layers.py')
-rw-r--r--models/layers.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/models/layers.py b/models/layers.py
index a9f04b3..7f2ccec 100644
--- a/models/layers.py
+++ b/models/layers.py
@@ -1,4 +1,4 @@
-from typing import Union
+from typing import Union, Tuple
import torch
import torch.nn as nn
@@ -10,7 +10,7 @@ class BasicConv2d(nn.Module):
self,
in_channels: int,
out_channels: int,
- kernel_size: Union[int, tuple[int, int]],
+ kernel_size: Union[int, Tuple[int, int]],
**kwargs
):
super().__init__()
@@ -29,7 +29,7 @@ class VGGConv2d(BasicConv2d):
self,
in_channels: int,
out_channels: int,
- kernel_size: Union[int, tuple[int, int]] = 3,
+ kernel_size: Union[int, Tuple[int, int]] = 3,
padding: int = 1,
**kwargs
):
@@ -47,7 +47,7 @@ class BasicConvTranspose2d(nn.Module):
self,
in_channels: int,
out_channels: int,
- kernel_size: Union[int, tuple[int, int]],
+ kernel_size: Union[int, Tuple[int, int]],
**kwargs
):
super().__init__()
@@ -66,7 +66,7 @@ class DCGANConvTranspose2d(BasicConvTranspose2d):
self,
in_channels: int,
out_channels: int,
- kernel_size: Union[int, tuple[int, int]] = 4,
+ kernel_size: Union[int, Tuple[int, int]] = 4,
stride: int = 2,
padding: int = 1,
is_last_layer: bool = False,
@@ -104,7 +104,7 @@ class FocalConv2d(BasicConv2d):
self,
in_channels: int,
out_channels: int,
- kernel_size: Union[int, tuple[int, int]],
+ kernel_size: Union[int, Tuple[int, int]],
halving: int,
**kwargs
):
@@ -124,8 +124,8 @@ class FocalConv2dBlock(nn.Module):
self,
in_channels: int,
out_channels: int,
- kernel_sizes: tuple[int, int],
- paddings: tuple[int, int],
+ kernel_sizes: Tuple[int, int],
+ paddings: Tuple[int, int],
halving: int,
use_pool: bool = True,
**kwargs
@@ -151,7 +151,7 @@ class BasicConv1d(nn.Module):
self,
in_channels: int,
out_channels: int,
- kernel_size: Union[int, tuple[int]],
+ kernel_size: Union[int, Tuple[int]],
**kwargs
):
super().__init__()
@@ -167,7 +167,7 @@ class HorizontalPyramidPooling(BasicConv2d):
self,
in_channels: int,
out_channels: int,
- kernel_size: Union[int, tuple[int, int]] = 1,
+ kernel_size: Union[int, Tuple[int, int]] = 1,
use_avg_pool: bool = True,
use_max_pool: bool = True,
**kwargs