MCPcopy Create free account
hub / github.com/LeapLabTHU/ActiveNeRF / batchify_rays

Function batchify_rays

run_nerf.py:53–65  ·  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

51
52
53def batchify_rays(rays_flat, chunk=1024*32, **kwargs):
54 """Render rays in smaller minibatches to avoid OOM.
55 """
56 all_ret = {}
57 for i in range(0, rays_flat.shape[0], chunk):
58 ret = render_rays(rays_flat[i:i+chunk], **kwargs)
59 for k in ret:
60 if k not in all_ret:
61 all_ret[k] = []
62 all_ret[k].append(ret[k])
63
64 all_ret = {k : torch.cat(all_ret[k], 0) for k in all_ret}
65 return all_ret
66
67
68def render(H, W, focal, chunk=1024*32, rays=None, c2w=None, ndc=True,

Callers 1

renderFunction · 0.85

Calls 1

render_raysFunction · 0.85

Tested by

no test coverage detected