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

Function batchify

script/models/nerf.py:13–20  ·  view source on GitHub ↗

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

(fn, chunk)

Source from the content-addressed store, hash-verified

11to8b = lambda x : (255*np.clip(x,0,1)).astype(np.uint8)
12
13def batchify(fn, chunk):
14 """Constructs a version of 'fn' that applies to smaller batches.
15 """
16 if chunk is None:
17 return fn
18 def ret(inputs):
19 return torch.cat([fn(inputs[i:i+chunk]) for i in range(0, inputs.shape[0], chunk)], 0)
20 return ret
21
22
23def run_network(inputs, viewdirs, fn, embed_fn, embeddirs_fn, netchunk=1024*64):

Callers 2

run_networkFunction · 0.85
run_network_DNeRFFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected