MCPcopy Create free account
hub / github.com/Francis-Rings/MotionFollower / Downsample3D

Class Downsample3D

src/models/resnet.py:86–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84
85
86class Downsample3D(nn.Module):
87 def __init__(
88 self, channels, use_conv=False, out_channels=None, padding=1, name="conv"
89 ):
90 super().__init__()
91 self.channels = channels
92 self.out_channels = out_channels or channels
93 self.use_conv = use_conv
94 self.padding = padding
95 stride = 2
96 self.name = name
97
98 if use_conv:
99 self.conv = InflatedConv3d(
100 self.channels, self.out_channels, 3, stride=stride, padding=padding
101 )
102 else:
103 raise NotImplementedError
104
105 def forward(self, hidden_states):
106 assert hidden_states.shape[1] == self.channels
107 if self.use_conv and self.padding == 0:
108 raise NotImplementedError
109
110 assert hidden_states.shape[1] == self.channels
111 hidden_states = self.conv(hidden_states)
112
113 return hidden_states
114
115
116class ResnetBlock3D(nn.Module):

Callers 2

__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected