MCPcopy Create free account
hub / github.com/baaivision/Uni3D / forward

Method forward

models/point_encoder.py:193–224  ·  view source on GitHub ↗
(self, pts, colors)

Source from the content-addressed store, hash-verified

191
192
193 def forward(self, pts, colors):
194 # divide the point cloud in the same form. This is important
195 _, center, features = self.group_divider(pts, colors)
196
197 # encoder the input cloud patches
198 group_input_tokens = self.encoder(features) # B G N
199 group_input_tokens = self.encoder2trans(group_input_tokens)
200 # prepare cls
201 cls_tokens = self.cls_token.expand(group_input_tokens.size(0), -1, -1)
202 cls_pos = self.cls_pos.expand(group_input_tokens.size(0), -1, -1)
203 # add pos embedding
204 pos = self.pos_embed(center)
205 # final input
206 x = torch.cat((cls_tokens, group_input_tokens), dim=1)
207 pos = torch.cat((cls_pos, pos), dim=1)
208 # transformer
209 x = x + pos
210 # x = x.half()
211
212 # a patch_dropout of 0. would mean it is disabled and this function would do nothing but return what was passed in
213 x = self.patch_dropout(x)
214
215 x = self.visual.pos_drop(x)
216
217 # ModuleList not support forward
218 for i, blk in enumerate(self.visual.blocks):
219 x = blk(x)
220 x = self.visual.norm(x[:, 0, :])
221 x = self.visual.fc_norm(x)
222
223 x = self.trans2embed(x)
224 return x

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected