I need to transform each input tensor in the following manner, for each iteration:
#input_batch shape: (64, in_channels, 224, 224)
outputs = []

for ch in range(in_channels):
    tensor = my_fn(input_batch[:,ch,:,:])   #transform from (64, 1, 224, 224) to (64, 32, 224, 224)
    outputs.append(tensor)
result = torch.cat(outputs, dim=1)  #shape (64, 32*in_channels, 224, 224)

in_channels is typically 3, but can be more.
Is appending to list better than doing torch.cat incrementally inside the loop?