Hi Deponce!



 deponce:

what if there are more than 1000 'custom_conv2d’s? Is there a method to automatically initiate the 'custom_conv2d’s by a for loop?


Yes, you can write a method that will “automatically” create and
initialize a large number of custom_conv2ds with a for loop.
When you define your custom_cond2d_layer you will be defining a
new class (that is a subclass of Module).  You will define for this
class an __init__() function that gets called every time you create
a new instance of the custom_cond2d_layer class.  This function
initializes the new instance.  (In other languages such a function is
often called the class’s constructor.)
You have to write the code, but this __init__() can run a loop that
creates (instantiates) 1000 (or however many) instances of your
custom_conv2d class and puts (references to) those instances into
a list (or other container) that is a property of the new instance of
your custom_conv2d_layer class.
(During the forward pass, the forward() function of your
custom_conv2d_layer could iterate over the list (or other container)
of custom_conv2ds, applying them to the appropriate “chunks” of the
input, and then cat() together those results to create the final result
returned by forward().)
Best.
K. Frank