Train same network for two data-set

Is it possible to train same network architecture using two different dataset. For the first dataset the forward function is different in comparison to the second dataset training.

Yes, you could theoretically add a condition into the forward method and pass e.g. a flag to it to switch between different execution paths.
However, while this would be possible during training you would have to think about the validation/testing use case and if you would be able to pass this flag to the forward method as well.
If not, you might be able to use some data conditions to switch between these execution paths.