diff options
Diffstat (limited to 'text_recognizer/networks/vqvae/resize.py')
-rw-r--r-- | text_recognizer/networks/vqvae/resize.py | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/text_recognizer/networks/vqvae/resize.py b/text_recognizer/networks/vqvae/resize.py deleted file mode 100644 index 8d67d02..0000000 --- a/text_recognizer/networks/vqvae/resize.py +++ /dev/null @@ -1,19 +0,0 @@ -"""Up and down-sample with linear interpolation.""" -from torch import nn, Tensor -import torch.nn.functional as F - - -class Upsample(nn.Module): - """Upsamples by a factor 2.""" - - def forward(self, x: Tensor) -> Tensor: - """Applies upsampling.""" - return F.interpolate(x, scale_factor=2.0, mode="nearest") - - -class Downsample(nn.Module): - """Downsampling by a factor 2.""" - - def forward(self, x: Tensor) -> Tensor: - """Applies downsampling.""" - return F.avg_pool2d(x, kernel_size=2, stride=2) |