Hi,
I am not clear about what needs to be a class member for a model and what not.
Let’s take a simple model:
class CNN(torch.nn.Module):
def init(self):
super(CNN, self).init()
    self.conv1 = torch.nn.Conv2d(1, 8, 3, 1)
    self.pool1 = torch.nn.MaxPool2d(4)
    self.relu1 = torch.nn.ReLU()

    self.conv2 = torch.nn.Conv2d(8, 8, 3, 1)
    self.pool2 = torch.nn.MaxPool2d(4)
    self.relu2 = torch.nn.ReLU()

1- Do we need to include the pooling and activation functions/objects as class members.
2- Let’s say we use the same pooling and/or activation functions in our model in different layers. Do we need to include them as separate class members or can we use the same object?
As far as I understand optimizer will need to access model parameters to update them. So as long as an object does not have a parameter to be updated we don’t need to include it as a class member. What are the examples of pooling/activation/etc. objects that have parameters?
Thanks