Both code snippets will create the same output.
It’s basically a question of your coding style.
In the second example, you could add some debugging print statement slightly easier, e.g. in case you would like to see the shape of the intermediate activation.