How to apply a nn.Module (i.e. CNN) across an axis (i.e. Video input) in a parallelizable way

Hi, I’m trying to apply CNN to each image in a video. Currently, my implementation uses a for loop and where I take each image and apply the CNN module in the loop. But clearly, this is sequential and I don’t see why it can’t be parallelized in theory since all images are independent from each other.

However, I’m not sure how this can be accomplished. I couldn’t find any built-in function for PyTorch. Is there a way to do this in parallel in PyTorch Lightning?

My video input shape looks like this: (batch_size, seq_len, channel, height, width) and CNN takes input shape of (batch_size, channel, height, width).

Thanks in advance for your help!

Hello, my apology for the late reply. We are slowly converging to deprecate this forum in favor of the GH build-in version… Could we kindly ask you to recreate your question there - Lightning Discussions

OK, I’ll do that - thank you

1 Like