File size: 1,091 Bytes
2a8a75a |
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
import torch.nn as nn
import torch.nn.functional as F
class SdfMlp(nn.Module):
def __init__(self, input_dim, hidden_dim=512, bias=True):
super().__init__()
self.input_dim = input_dim
self.hidden_dim = hidden_dim
self.fc1 = nn.Linear(input_dim, hidden_dim, bias=bias)
self.fc2 = nn.Linear(hidden_dim, hidden_dim, bias=bias)
self.fc3 = nn.Linear(hidden_dim, 4, bias=bias)
def forward(self, input):
x = F.relu(self.fc1(input))
x = F.relu(self.fc2(x))
out = self.fc3(x)
return out
class RgbMlp(nn.Module):
def __init__(self, input_dim, hidden_dim=512, bias=True):
super().__init__()
self.input_dim = input_dim
self.hidden_dim = hidden_dim
self.fc1 = nn.Linear(input_dim, hidden_dim, bias=bias)
self.fc2 = nn.Linear(hidden_dim, hidden_dim, bias=bias)
self.fc3 = nn.Linear(hidden_dim, 3, bias=bias)
def forward(self, input):
x = F.relu(self.fc1(input))
x = F.relu(self.fc2(x))
out = self.fc3(x)
return out
|