added base class and methods; done logic for building graph

This commit is contained in:
evonneng committed 2022-04-12 19:36:55 +00:00
1 parent 69ea3ae45e
commit 39346ccf40
5 files changed
+80 -40

No files matched your search

+2 -17
View File
@@ -2,11 +2,11 @@
Encoding functions
"""
import torch
from torch import nn
from torchtyping import TensorType
from mattport.nerf.modules.module import Module
class Encoding(nn.Module):
class Encoding(Module):
"""Encode an input tensor. Intended to be subclassed"""
def __init__(self, in_dim: int) -> None:
@@ -19,21 +19,6 @@ class Encoding(nn.Module):
raise ValueError("Input dimension should be greater than zero")
self.in_dim = in_dim
def build_model(self) -> None:
"""TODO: create base module class from which this extends"""
def set_in_dim(self, in_dim: int) -> None:
"""TODO: create base module class from which this extends"""
self.in_dim = in_dim
def get_out_dim(self) -> int:
"""Calculates output dimension of encoding.
Returns:
int: output dimension
"""
raise NotImplementedError
def encode(self, in_tensor: TensorType[..., "input_dim"]) -> TensorType[..., "output_dim"]:
"""Encodes an input tensor.