For clarification, the inputs are gray scale so they have 1 channel and are of shape (1, W, D, H) and the network takes in batches of these inputs and outputs a tensor of size (B, 10, W, D, H) where 10 is the number of classes (10). I have been looking into nn.Fold and nn.Unfold but I noticed that they only work on 4D tensors, so I could theoretically unfold the input volumes because they are 4D, but I cannot fold them back together because the output is a 5D tensor.