mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-01 21:39:06 +08:00
done logic to instantiate graph, test to check instantiation
This commit is contained in:
1 parent
91f57726ae
commit
62aee54611
6 files changed
+84
-26
No files matched your search
@@ -0,0 +1,2 @@
|
||||
from .encoding import Encoding
|
||||
from .mlp import MLP
|
||||
@@ -8,9 +8,9 @@ from torchtyping import TensorType
|
||||
class Encoding(nn.Module):
|
||||
"""Encode an input tensor. Intended to be subclassed"""
|
||||
|
||||
def __init__(self, name: str, inputs: list, meta_data: dict) -> None:
|
||||
def __init__(self, out_dim: int) -> None:
|
||||
super().__init__()
|
||||
raise NotImplementedError
|
||||
# raise NotImplementedError
|
||||
|
||||
def encode(self, in_tensor: TensorType[..., "input_dim"]) -> TensorType[..., "output_dim"]:
|
||||
"""Encodes an input tensor.
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
from typing import Optional
|
||||
|
||||
from torch import nn
|
||||
from torchtyping import TensorType
|
||||
|
||||
|
||||
class MLP(nn.Module):
|
||||
@@ -10,7 +13,7 @@ class MLP(nn.Module):
|
||||
out_dim: int,
|
||||
num_layers: int,
|
||||
layer_width: int,
|
||||
activation: Optional[nn.Module] = nn.ReLU,
|
||||
activation: Optional[nn.Module] = None,
|
||||
out_activation: Optional[nn.Module] = None,
|
||||
) -> None:
|
||||
"""Initialize mulilayer perceptron.
|
||||
@@ -24,6 +27,7 @@ class MLP(nn.Module):
|
||||
out_activation (Optional[nn.Module], optional): output activation function. Defaults to None.
|
||||
"""
|
||||
super().__init__()
|
||||
self.in_dim = in_dim
|
||||
layers = []
|
||||
for i in range(num_layers):
|
||||
if i == 0:
|
||||
|
||||
Reference in new issue
Block a user