File size: 574 Bytes
c20d7cc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
"""Contains the base class for encoders.
For licensing see accompanying LICENSE file.
Copyright (C) 2025 Apple Inc. All Rights Reserved.
"""
import abc
import torch
from torch import nn
class BaseEncoder(nn.Module, abc.ABC):
"""Base encoder class."""
dim_in: int
output_dims: list[int]
@abc.abstractmethod
def forward(self, image: torch.Tensor) -> list[torch.Tensor]:
"""Encode input image into multi-resolution encodings."""
def internal_resolution(self) -> int:
"""Internal resolution of the encoder."""
return 1536
|