Code for subslicing
tmke8 opened this issue · comments
def strided_subsample(x):
c, w, h = x.shape[-3:]
w, h = w // 2, h // 2
x = x.view(-1, c, w, 2, h, 2)
x = x.transpose(-1, -2).contiguous()
x = x.view(-1, c, w, 4, h)
x = x.transpose(-2, -3).contiguous()
x = x.view(x.size(0), -1, w, h)
return x
Turns out, the existing code does exactly this...