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

Function run_network

script/models/nerf.py:23–37  ·  view source on GitHub ↗

Prepares inputs and applies network 'fn'.

(inputs, viewdirs, fn, embed_fn, embeddirs_fn, netchunk=1024*64)

Source from the content-addressed store, hash-verified

21
22
23def run_network(inputs, viewdirs, fn, embed_fn, embeddirs_fn, netchunk=1024*64):
24 """Prepares inputs and applies network 'fn'.
25 """
26 inputs_flat = torch.reshape(inputs, [-1, inputs.shape[-1]])
27 embedded = embed_fn(inputs_flat)
28
29 if viewdirs is not None:
30 input_dirs = viewdirs[:,None].expand(inputs.shape)
31 input_dirs_flat = torch.reshape(input_dirs, [-1, input_dirs.shape[-1]])
32 embedded_dirs = embeddirs_fn(input_dirs_flat)
33 embedded = torch.cat([embedded, embedded_dirs], -1)
34
35 outputs_flat = batchify(fn, netchunk)(embedded)
36 outputs = torch.reshape(outputs_flat, list(inputs.shape[:-1]) + [outputs_flat.shape[-1]])
37 return outputs
38
39def run_network_DNeRF(inputs, viewdirs, fn, embed_fn, embeddirs_fn, netchunk=1024*64, epoch=None, no_DNeRF_viewdir=False):
40 """Prepares inputs and applies network 'fn'.

Callers 2

create_nerfFunction · 0.90
create_nerfFunction · 0.85

Calls 1

batchifyFunction · 0.85

Tested by

no test coverage detected