I think unfold is new in 0.4.
The actual unfold function itself is present in torch for years. So, you could use FFI to call it. It’s not that hard to use FFI from pytorch AFAIK, but it’s not something I can describe in a few lines, partly because I’d have to go away and google, search for pytorch forums posts on it. I’ve done FFI from python before though, and it’s fairly painless, if you have a few days to kill.
On the whole, if upgrading to 0.4 will take less than ~few hours effort, I’d go for the 0.4 solution probably.
(note that ‘unfold’ used to be called ‘im2col’ as Simon alludes to)