well, let’s see…
you want to compact a dimension in the middle, I’ll simplify this to dims representing (B*C,T,H*W) and sizes 2,4,3

x = torch.zeros(2,4,3)
x[:,::2].copy_(torch.arange(12).view(2,2,3)) #values we want to extract
y = x.view(2*4,3)[:4] #compact and truncated area to copy into
y.copy_(x[:,::2].view_as(y))
y = y.view(2,2,3) #unflatten head dimensions

this works on cpu with sequential copying, I have a suspiction that this may break on GPU (maybe for some shapes) if thread block execution gets reordered by the scheduler - really not sure about this.