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

Function run_network_DNeRF

script/models/nerf.py:39–60  ·  view source on GitHub ↗

Prepares inputs and applies network 'fn'.

(inputs, viewdirs, fn, embed_fn, embeddirs_fn, netchunk=1024*64, epoch=None, no_DNeRF_viewdir=False)

Source from the content-addressed store, hash-verified

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'.
41 """
42 if epoch<0 or epoch==None:
43 print("Error: run_network_DNeRF(): Invalid epoch")
44 sys.exit()
45 inputs_flat = torch.reshape(inputs, [-1, inputs.shape[-1]])
46 embedded = embed_fn(inputs_flat, epoch)
47 # add weighted function here
48 if viewdirs is not None:
49 input_dirs = viewdirs[:,None].expand(inputs.shape)
50 input_dirs_flat = torch.reshape(input_dirs, [-1, input_dirs.shape[-1]])
51
52 if no_DNeRF_viewdir:
53 embedded_dirs = embeddirs_fn(input_dirs_flat)
54 else:
55 embedded_dirs = embeddirs_fn(input_dirs_flat, epoch)
56 embedded = torch.cat([embedded, embedded_dirs], -1)
57
58 outputs_flat = batchify(fn, netchunk)(embedded)
59 outputs = torch.reshape(outputs_flat, list(inputs.shape[:-1]) + [outputs_flat.shape[-1]])
60 return outputs
61
62
63# Positional encoding (section 5.1)

Callers 1

create_nerfFunction · 0.85

Calls 1

batchifyFunction · 0.85

Tested by

no test coverage detected