mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-04 14:58:55 +08:00
Factor out nerf_field
This commit is contained in:
1 parent
279df6a9ce
commit
9b63adba01
5 files changed
+140
-126
No files matched your search
@@ -2,6 +2,7 @@
|
||||
Encoding functions
|
||||
"""
|
||||
|
||||
from abc import abstractmethod
|
||||
import numpy as np
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
@@ -25,6 +26,7 @@ class Encoding(FieldModule):
|
||||
raise ValueError("Input dimension should be greater than zero")
|
||||
self.in_dim = in_dim
|
||||
|
||||
@abstractmethod
|
||||
def encode(self, in_tensor: TensorType[..., "input_dim"]) -> TensorType[..., "output_dim"]:
|
||||
"""Encodes an input tensor.
|
||||
|
||||
@@ -41,6 +43,16 @@ class Encoding(FieldModule):
|
||||
return self.encode(in_tensor)
|
||||
|
||||
|
||||
class Identity(Encoding):
|
||||
"""Identity encoding (Does not modify input)"""
|
||||
|
||||
def get_out_dim(self) -> int:
|
||||
return self.in_dim
|
||||
|
||||
def encode(self, in_tensor: TensorType[..., "input_dim"]) -> TensorType[..., "output_dim"]:
|
||||
return in_tensor
|
||||
|
||||
|
||||
class ScalingAndOffset(Encoding):
|
||||
"""Simple scaling and offet to input"""
|
||||
|
||||
|
||||
Reference in new issue
Block a user