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

ConvCaps p_in a_in view #3

Open
tomahawk810 opened this issue Oct 17, 2018 · 3 comments
Open

ConvCaps p_in a_in view #3

tomahawk810 opened this issue Oct 17, 2018 · 3 comments

Comments

@tomahawk810
Copy link

tomahawk810 commented Oct 17, 2018

I think there is an issue in the way the input tensor x is reshaped in order to extract a_in and p_in.
It seems to me that the dimensions of a_in and p_in require a permutation before applying Tensor.view().

Note that I changed the training batch size to 16, also I am using A, B, C, D = 32, 32, 32, 32.

Transformation before view:

After this line:

p_in = x[:, :, :, :, :, :self.B*self.psize].contiguous()

I get this:

p_in.shape
Out[2]: torch.Size([16, 3, 3, 6, 6, 512])

View:

The view is done in the following way:

p_in = p_in.view(b*oh*ow, self.K*self.K*self.B, self.psize)

To do the view in this way, p_in.shape should be:
torch.Size([16, 6, 6, 3, 3, 512])

Do you agree? I am new to Pytorch, so I might misunderstand the way Tensor.view() works.

@yl-1993
Copy link
Owner

yl-1993 commented Nov 19, 2018

@tomahawk810

Sorry about the late reply, as I am busy preparing cvpr submission.

As stated in

Output: (b, H', W', K, K, B*(P*P+1))

The shape of x after adding patches is (b, H', W', K, K, B*(P*P+1)).
Therefore, the shape of p_in is (b, H', W', K, K, B*P*P).
For view, actually it can be split into two steps:

p_in = p_in.view(b*H'*W', K*K, B, P*P)
p_in = p_in.view(b*H'*W', K*K, B*P*P)

@yl-1993
Copy link
Owner

yl-1993 commented Nov 19, 2018

@tomahawk810 I get your point now.
I check the code and you are right about the output shape.
The issue lies in the add_patches function.

I have fixed the problem now. Could you please help review the PR #4?

Thanks for pointing out!

@yl-1993
Copy link
Owner

yl-1993 commented Dec 3, 2018

@tomahawk810 I merge the PR since there is no comment for two weeks.
Please continue to comment if you feel anything is weird.

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