Why is the sequence of layers in print(model) not the same as defined in the forward method?
Because the forward
function has no relation to print(model)
.
print(model)
prints the models attributes defined in the __init__
function in the order they were defined.
The result will be the same no matter what you wrote in your forward
function. It would even be the same even if your forward
function didn’t exist.