-
Notifications
You must be signed in to change notification settings - Fork 19.4k
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
Conversation
👍 |
|
||
def get_output(self, train): | ||
X = self.get_input(train) | ||
Y = theano.tensor.extra_ops.repeat(X, self.upsample_size[0], axis = -2) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, fixed.
Negative axis indices have been removed from UpSample2D to make the operation clearer. |
Merged. I think this would need tests, though (let's try not to add code that does not have unit tests). |
Certainly. I've already tested both layers extensively. |
Cool, I'm sure you have. I mean, specifically, adding unit tests for these layers in |
Co-authored-by: Haifeng Jin <haifeng-jin@users.noreply.github.com>
Co-authored-by: Haifeng Jin <haifeng-jin@users.noreply.github.com>
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