MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / downsample

Function downsample

scripts/inv-rendering/loss.py:20–30  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

18
19
20def downsample(input):
21 if input.size(0) % 2 == 1:
22 input = torch.cat((input, torch.unsqueeze(input[-1, :], 0)), dim=0)
23 if input.size(1) % 2 == 1:
24 input = torch.cat((input, torch.unsqueeze(input[:, -1], 1)), dim=1)
25 return (
26 input[0::2, 0::2, :]
27 + input[1::2, 0::2, :]
28 + input[0::2, 1::2, :]
29 + input[1::2, 1::2, :]
30 ) * 0.25
31
32
33def build_pyramid(img):

Callers 1

build_pyramidFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected