Hi, I have a self-defined operator. For every layer, I need to run multiple operators in parallel, just like multiple convolutional kernels in each layer. As is known, nn.Sequential
is a good way to run several operators in sequential order. But I can’t find similar class to run operators in parallel manner, may be nn.Parallel
.
I have two optional methods to achieve the goal without considering running time or memory. The first one is to use for
loop directly, and the second candidate is preparing multiple copies of the input. Both methods are naive and suffer from inefficiency in either running time or memory.
Is there any elegant way to achieve this?