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

Function batchify

run_nerf.py:26–33  ·  view source on GitHub ↗

Constructs a version of 'fn' that applies to smaller batches.

(fn, chunk)

Source from the content-addressed store, hash-verified

24
25
26def batchify(fn, chunk):
27 """Constructs a version of 'fn' that applies to smaller batches.
28 """
29 if chunk is None:
30 return fn
31 def ret(inputs):
32 return torch.cat([fn(inputs[i:i+chunk]) for i in range(0, inputs.shape[0], chunk)], 0)
33 return ret
34
35
36def run_network(inputs, viewdirs, fn, embed_fn, embeddirs_fn, netchunk=1024*64):

Callers 1

run_networkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected