How can I implemented pytorch unfold() function in python

I was unable to find the code for unfold() in its github repo.

Unfold is implemented in C in here. It only performs size/strides modifications, so it can be performed in python without issues.
Also, note that unfold supports backpropagation, so there might be no need to implement it yourself.