Self-made v.s. Pytorch-made: The processing difference

I’m new here. I wanna know the processing difference between self-made Deep Neural Network in Google Cola v.s. the one made of Pytorch.

I met a case where self-made one overflows while Pytorch-made one does not.

I mean, like, I build a DNN which predict where a ball gonna fall down once I give it parameters: Ball mass M, initial velocity and angle as V and THETA respectively.

When the parameter values are small(M=0-5, V=0-1), there is no problem. Both self-made and Pytorch-made work. However when the values are large (M=0-50, V=0-30), self-made one overflows. (Pytorch-made works.)

The errors are like ,

RuntimeWarning: overflow encountered in matmul

RuntimeWarning: invalid value encountered in matmul

Why could it happen? Is there some special processings in Pytorch? Or Does pytorch handle numbers in a different way?

Could you describe what “self-made” means in this context? Based on your description and the posted error messages it seems you are manually implementing a matmul operation which then overflows?