Skip to content

Instantly share code, notes, and snippets.

@ririw
Last active June 16, 2016 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ririw/fe88b22b1416c35307b7fbbca0af88ea to your computer and use it in GitHub Desktop.
Save ririw/fe88b22b1416c35307b7fbbca0af88ea to your computer and use it in GitHub Desktop.
A repeat layer for lasagne
## 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