f-dangel / unfoldNd

(N=1,2,3)-dimensional unfold (im2col) and fold (col2im) in PyTorch
MIT License
82 stars 6 forks source link

Building the one-hot kernel cheaper #9

Closed f-dangel closed 3 years ago

f-dangel commented 3 years ago

It should be possible to construct the one-hot kernel using expand instead of repeat.

Approach:

f-dangel commented 3 years ago

I did not find a clever way to use expand over repeat, as the axis to be repeated does not have dimension 1. However, the details on constructing the one-hot kernel are documented more clearly, and the creation is refactored and does not need a for loop anymore.