Print activations of a neural network in Pytorch
I was doing as suggested in this StackOverflow's questions: Pytorch: why print(model) does not show the activation functions?
Basically I want to train a neural network on MNIST, and I want to print the activations.
This is the neural networks:
class Net(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv1 = nn.Conv2d(1, 128, 5)
        self.pool = nn.MaxPool2d(2, 2)
        self.conv2 = nn.Conv2d(128, 256, 5)
        self.fc1 = nn.Linear(out_features, 120)
        self.fc2 = nn.Linear(120, 84)
        self.fc3 = nn.Linear(84, 10)
        self.myRelu = nn.ReLU()

    def forward(self, x):
        x = self.conv1(x)
        x = self.myRelu(x)
        x = self.pool(x)
        x = self.conv2(x)
        x = self.myRelu(x)
        x = self.pool(x)
        x = torch.flatten(x, 1) # flatten all dimensions except batch
        x = self.fc1(x)
        x = self.myRelu(x)
        x = self.fc2(x)
        x = self.myRelu(x)
        x = self.fc3(x)
        return x

However, if I do list(model.myRelu.parameters()) the result is an empty list: []. Any suggestion on how to print the activations?

I think you are getting mixed up between what the an activation function is an what you might be trying to show which are the activations of your intermediate layers. The question you are linking is asking about why isn't the activation function not showing in the summary of the PyTorch model.
On one hand, activation functions are non-linear functions, most generally non-parameterized, such as a ReLU function. This is the reason why you are not getting any parameters when looking at the content of model.myRelu.parameters(). It simply doesn't have any learned parameters!
On the other, you can be looking to inspect the intermediate results of your network. This means printing the output of a given layer, i.e. the activation of that layer. This is of course with respect to an input: for a given input x you are looking at the output of a given intermediate layer.

But reading your question again it seems you are just trying to print your model summary showing the activation functions inside it. In your case, this can be done by defining your model as a sequential model:
class Net(nn.Sequential):
    def __init__(self, out_features):
        super().__init__(nn.Conv2d(1, 128, 5),
                         nn.ReLU(),
                         nn.MaxPool2d(2, 2),
                         nn.Conv2d(128, 256, 5),
                         nn.ReLU(),
                         nn.MaxPool2d(2, 2),
                         nn.Flatten(),
                         nn.Linear(out_features, 120),
                         nn.ReLU(),
                         nn.Linear(120, 84),
                         nn.ReLU(),
                         nn.Linear(84, 10))

Then in the summary, you have:
&gt;&gt;&gt; Net(10)
Net(
  (0): Conv2d(1, 128, kernel_size=(5, 5), stride=(1, 1))
  (1): ReLU()
  (2): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
  (3): Conv2d(128, 256, kernel_size=(5, 5), stride=(1, 1))
  (4): ReLU()
  (5): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
  (6): Flatten(start_dim=1, end_dim=-1)
  (7): Linear(in_features=10, out_features=120, bias=True)
  (8): ReLU()
  (9): Linear(in_features=120, out_features=84, bias=True)
  (10): ReLU()
  (11): Linear(in_features=84, out_features=10, bias=True)
)

