MCPcopy Create free account
hub / github.com/OpenGVLab/UniFormerV2 / forward

Method forward

slowfast/models/head_helper.py:198–220  ·  view source on GitHub ↗
(self, inputs)

Source from the content-addressed store, hash-verified

196 )
197
198 def forward(self, inputs):
199 assert (
200 len(inputs) == self.num_pathways
201 ), "Input tensor does not contain {} pathway".format(self.num_pathways)
202 pool_out = []
203 for pathway in range(self.num_pathways):
204 m = getattr(self, "pathway{}_avgpool".format(pathway))
205 pool_out.append(m(inputs[pathway]))
206 x = torch.cat(pool_out, 1)
207 # (N, C, T, H, W) -> (N, T, H, W, C).
208 x = x.permute((0, 2, 3, 4, 1))
209 # Perform dropout.
210 if hasattr(self, "dropout"):
211 x = self.dropout(x)
212 x = self.projection(x)
213
214 # Performs fully convlutional inference.
215 if not self.training:
216 x = self.act(x)
217 x = x.mean([1, 2, 3])
218
219 x = x.view(x.shape[0], -1)
220 return x
221
222
223class X3DHead(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected