Is this what you are looking for?

Yes! I was trying to print the layers in a way that more closely resembled Lua/Torch7’s printing, like this:
Conv2d(3, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))

To:
Conv2d(3 -> 64, 3x3, 1,1, 1,1)

I had a complicated setup with replace and split, before using regex, but things still weren’t working. Hopefully I can make my code a lot more simple and easier to understand now!