Yes you “just” need to implement the same thing.
In practice. If you can write down exactly on paper what is the model, loss, regularization, etc. Then you can just make sure you apply them all the same way. And that you measure the difference when all of them have been applied.
Also note that due to floating point imprecision, it is expected that you will get very small differences between the two frameworks (or even across versions of a single framework). These differences will be increase by the gradient descent leading to different models.
If you model is stable and converges properly for different random initializations (with different random seed), it will still converge properly to a similar solution.