Should I change the internal function in pytorch?

I need to add some new functions or change some methods based on the internal functions in pytorch?
is it ok to directly operate with the internal functions? or should i create a copy first?
what is the general way

The usual route is to use an extension
Peter Goldsborough wrote a neat tutorial how to do this:

Best regards


thanks for your reply. maybe i did not clarify it. I mean to change or add new methods for the built-in functions in pytorch and the methods are also written in python.
for example, I want to add a new transform method for ImageFolder function (which is build-in in pytorch).
so what is the general way?