MCPcopy Create free account
hub / github.com/Sin3DM/Sin3DM / decode_batch

Method decode_batch

src/encoding/model.py:320–333  ·  view source on GitHub ↗

decode a batch of points triplane_feat: (c, h, w, d)

(self, triplane_feat, points, batch_size=2 ** 14, aabb=None)

Source from the content-addressed store, hash-verified

318
319 @torch.no_grad()
320 def decode_batch(self, triplane_feat, points, batch_size=2 ** 14, aabb=None):
321 """decode a batch of points
322 triplane_feat: (c, h, w, d)
323 """
324 self.net.eval()
325
326 preds = []
327 for i in tqdm(range(0, points.shape[0], batch_size)):
328 pts = points[i:i+batch_size]
329 rec = self.net.decode(pts, triplane_feat, aabb=aabb)
330 preds.append(rec)
331 preds = torch.cat(preds, dim=0)
332 preds[..., 1:] = preds[..., 1:].clamp_(0, 1) # color in [0, 1]
333 return preds
334
335 @torch.no_grad()
336 def decode_grid(self, triplane_feat, reso, batch_size=2 ** 14, aabb=None):

Callers 3

evaluateMethod · 0.95
decode_gridMethod · 0.95
decode_texmeshMethod · 0.95

Calls 2

tqdmFunction · 0.85
decodeMethod · 0.45

Tested by

no test coverage detected