MCPcopy Index your code
hub / github.com/ActiveVisionLab/DFNet / batchify_rays

Function batchify_rays

script/models/rendering.py:339–351  ·  view source on GitHub ↗

Render rays in smaller minibatches to avoid OOM.

(rays_flat, chunk=1024*32, **kwargs)

Source from the content-addressed store, hash-verified

337 return ret
338
339def batchify_rays(rays_flat, chunk=1024*32, **kwargs):
340 """Render rays in smaller minibatches to avoid OOM.
341 """
342 all_ret = {}
343 for i in range(0, rays_flat.shape[0], chunk):
344 ret = render_rays(rays_flat[i:i+chunk], **kwargs)
345 for k in ret:
346 if k not in all_ret:
347 all_ret[k] = []
348 all_ret[k].append(ret[k])
349
350 all_ret = {k : torch.cat(all_ret[k], 0) for k in all_ret}
351 return all_ret
352
353def render(H, W, focal, chunk=1024*32, rays=None, c2w=None, ndc=True,
354 near=0., far=1.,

Callers 1

renderFunction · 0.85

Calls 1

render_raysFunction · 0.85

Tested by

no test coverage detected