Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downsample / concatenate? #5

Closed
biggzlar opened this issue Jul 20, 2020 · 2 comments
Closed

Downsample / concatenate? #5

biggzlar opened this issue Jul 20, 2020 · 2 comments

Comments

@biggzlar
Copy link

Any explanation as to why this function is so involved? It's simply copying the input tensor and reshaping it. Why do we need four steps to do this?

def downsample_concatenate(X, kernel):

@jbcdnr
Copy link
Collaborator

jbcdnr commented Jul 20, 2020

I think the reshaping is not just one line because vertical neighboring pixels are not next to each other in memory. So for example for a 2x2 concatenation, we first concatenate the channels of the horizontal neighbors. Then permute the dimensions and concatenate the vertical neighbors that are contiguous in memory. I was a bit crazy with the .contiguous(), some are maybe not necessary but they would lead to a no op so should not be a problem ;)

I am curious if you have a better/simpler solution that passes a test to match the output of my function.

@jbcdnr
Copy link
Collaborator

jbcdnr commented Jul 20, 2020

It could be made simpler using unfold probably.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants