Skip to content

Instantly share code, notes, and snippets.

@ssampang
Created January 1, 2016 15:28
Show Gist options
  • Save ssampang/396be1c6d40928097c02 to your computer and use it in GitHub Desktop.
Save ssampang/396be1c6d40928097c02 to your computer and use it in GitHub Desktop.
old = lasagne.layers.get_all_param_values(self.output_layer)
new = []
for layer in old:
shape = layer.shape
if len(shape)<2:
shape = (shape[0], 1)
W= lasagne.init.GlorotUniform()(shape)
if W.shape != layer.shape:
W = np.squeeze(W, axis= 1)
new.append(W)
lasagne.layers.set_all_param_values(self.output_layer, new)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment