I solved it myself.
I found out that there is no function to save the model after allocating_tensor. Since this question is not solved, I will mark it as Solved.