summaryrefslogtreecommitdiff
path: root/models/auto_encoder.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/auto_encoder.py
parent4a284084c253b9114fc02e1782962556ff113761 (diff)
Type hint for python version lower than 3.9
Diffstat (limited to 'models/auto_encoder.py')
-rw-r--r--models/auto_encoder.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/models/auto_encoder.py b/models/auto_encoder.py
index 7c1f7ef..1e7c323 100644
--- a/models/auto_encoder.py
+++ b/models/auto_encoder.py
@@ -1,3 +1,5 @@
+from typing import Tuple
+
import torch
import torch.nn as nn
import torch.nn.functional as F
@@ -12,7 +14,7 @@ class Encoder(nn.Module):
self,
in_channels: int = 3,
feature_channels: int = 64,
- output_dims: tuple[int, int, int] = (128, 128, 64)
+ output_dims: Tuple[int, int, int] = (128, 128, 64)
):
super().__init__()
self.feature_channels = feature_channels
@@ -67,7 +69,7 @@ class Decoder(nn.Module):
def __init__(
self,
- input_dims: tuple[int, int, int] = (128, 128, 64),
+ input_dims: Tuple[int, int, int] = (128, 128, 64),
feature_channels: int = 64,
out_channels: int = 3,
):
@@ -116,7 +118,7 @@ class AutoEncoder(nn.Module):
num_class: int = 74,
channels: int = 3,
feature_channels: int = 64,
- embedding_dims: tuple[int, int, int] = (128, 128, 64)
+ embedding_dims: Tuple[int, int, int] = (128, 128, 64)
):
super().__init__()
self.encoder = Encoder(channels, feature_channels, embedding_dims)