Constructs a version of 'fn' that applies to smaller batches.
(fn, chunk)
| 11 | to8b = lambda x : (255*np.clip(x,0,1)).astype(np.uint8) |
| 12 | |
| 13 | def 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 | |
| 23 | def run_network(inputs, viewdirs, fn, embed_fn, embeddirs_fn, netchunk=1024*64): |
no outgoing calls
no test coverage detected