codecsplat / src /model /encoder /encoder.py
multimodalart's picture
multimodalart HF Staff
CodecSplat demo
7405e85 verified
Raw History Blame Contribute Delete
610 Bytes
from abc import ABC, abstractmethod
from typing import Generic, TypeVar
from torch import nn
from ...dataset.types import BatchedViews, DataShim
from ..types import Gaussians
T = TypeVar("T")
class Encoder(nn.Module, ABC, Generic[T]):
cfg: T
def __init__(self, cfg: T) -> None:
super().__init__()
self.cfg = cfg
@abstractmethod
def forward(
self,
context: BatchedViews,
global_step: int,
) -> Gaussians:
pass
def get_data_shim(self) -> DataShim:
"""The default shim doesn't modify the batch."""
return lambda x: x