Last active
June 16, 2016 07:00
-
-
Save ririw/fe88b22b1416c35307b7fbbca0af88ea to your computer and use it in GitHub Desktop.
A repeat layer for lasagne
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## THIS IS WRONG, it'll return the wrong shape. I'll need | |
## to tweak it to make it work | |
#class Repeat(lasagne.layers.Layer): | |
# def __init__(self, incoming, n, **kwargs): | |
# super(Repeat, self).__init__(incoming, **kwargs) | |
# self.n = n | |
# | |
# def get_output_shape_for(self, input_shape): | |
# return tuple([self.n] + list(input_shape)) | |
# | |
# def get_output_for(self, input, **kwargs): | |
# new_shape = T.concatenate([[self.n], T.shape(input)]) | |
# new_dims = input.ndim + 1 | |
# return T.tile(input, self.n).reshape(new_shape, ndim=new_dims) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment