Thanks for the hints.
I need to make the process automated and general, no matter what the model is.
Is there anyway to figure out if the model uses softmax in the forward method?
Still it is not clear how to remove that layer while keep the operators in the forward exactly same as original model.