MCPcopy Create free account
hub / github.com/microsoft/TRELLIS / FeedForwardNet

Class FeedForwardNet

trellis/modules/transformer/blocks.py:49–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47
48
49class FeedForwardNet(nn.Module):
50 def __init__(self, channels: int, mlp_ratio: float = 4.0):
51 super().__init__()
52 self.mlp = nn.Sequential(
53 nn.Linear(channels, int(channels * mlp_ratio)),
54 nn.GELU(approximate="tanh"),
55 nn.Linear(int(channels * mlp_ratio), channels),
56 )
57
58 def forward(self, x: torch.Tensor) -> torch.Tensor:
59 return self.mlp(x)
60
61
62class TransformerBlock(nn.Module):

Callers 4

__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected