Alternate approach rather than using vars(self)[f'conv2D_{i}']

Is it just me or anyone else thinks that using the vars approach as in vars(self)[f'conv2D_{i}'] while defining

class Block(tf.keras.Model):
    def __init__(self, filters, kernel_size, repetitions, pool_size=2, strides=2):

In the assignment is unnecessarily complicated? There should be easier/cleaner approach than this (that still uses the Model class approach).

You can initialize all the layers of the VGG network inside the init method and then define the forward behaviour in the call method. But this requires you to explicitly initialize all the layers.

Since the VGG network consists of several Conv2D layers having different numbers of filters, it becomes easier to initialize the layers using the vars method. This helps you to avoid repeating code.