I would guess that this is because Theano compiles the whole thing ahead of time. So it can do many optiomizations that pytorch cannot do   That’s the price to pay to have flexibility.
I am surprised that tensorflow is slower though.