Just to save others from making my mistake: I was confused at first because there is a function, a method, and a class all called “unfold”, and Google finds #1 first.  However,  @ptrblck used #3 in the answer above,  I think (#1 has different arguments).


torch.nn.functional.unfold 39 (Python function, in torch.nn.functional)

torch.nn.Unfold 22 (Python class, in Unfold)

torch.Tensor.unfold 74 (Python method, in torch.Tensor)