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

Added Up Sampling (inverse Max Pooling) Layers #532

Merged
merged 2 commits into from
Aug 16, 2015
Merged

Added Up Sampling (inverse Max Pooling) Layers #532

merged 2 commits into from
Aug 16, 2015

Conversation

anayebi
Copy link
Contributor

@anayebi anayebi commented Aug 15, 2015

I've added two new layers to perform up sampling to convolutional.py, in response to: https://groups.google.com/forum/#!topic/theano-users/wy9Fuy5pWU0

The documentation for both layers is below:

UpSample1D:

Description: This layer up samples input across one dimension (e.g. inverse MaxPooling1D)
Input shape: (nb_samples, steps, dim)
Output shape: (nb_samples, upsampled_steps, dim)
Potential use case: For stacking after a MaxPooling1D Layer

UpSample2D:

Description: This layer upsamples input across two dimensions (e.g. inverse MaxPooling2D)
Input shape: (nb_samples, stack_size, nb_row, nb_col)
Output shape: (nb_samples, stack_size, new_nb_row, new_nb_col)
Potential use case: For stacking after a MaxPooling2D Layer

@pranv
Copy link
Contributor

pranv commented Aug 15, 2015

👍


def get_output(self, train):
X = self.get_input(train)
Y = theano.tensor.extra_ops.repeat(X, self.upsample_size[0], axis = -2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use negative axis indexes here, since the tensor shape is completely known?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular reason, just my own style preference. Would you like me to change that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make the operation clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, fixed.

@anayebi
Copy link
Contributor Author

anayebi commented Aug 16, 2015

Negative axis indices have been removed from UpSample2D to make the operation clearer.

@fchollet fchollet merged commit 024a88f into keras-team:master Aug 16, 2015
@fchollet
Copy link
Member

Merged. I think this would need tests, though (let's try not to add code that does not have unit tests).

@anayebi
Copy link
Contributor Author

anayebi commented Aug 16, 2015

Certainly. I've already tested both layers extensively.

@fchollet
Copy link
Member

Cool, I'm sure you have. I mean, specifically, adding unit tests for these layers in tests/auto/keras/layers.

fchollet pushed a commit that referenced this pull request Sep 22, 2023
Co-authored-by: Haifeng Jin <haifeng-jin@users.noreply.github.com>
hubingallin pushed a commit to hubingallin/keras that referenced this pull request Sep 22, 2023
Co-authored-by: Haifeng Jin <haifeng-jin@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

None yet

3 participants