lib/dnn/core/layers.rb in ruby-dnn-0.5.2 vs lib/dnn/core/layers.rb in ruby-dnn-0.5.3
- old
+ new
@@ -30,12 +30,14 @@
def shape
prev_layer.shape
end
# Layer to a hash.
- def to_hash(hash)
- {name: self.class.name}.merge(hash)
+ def to_hash(merge_hash = nil)
+ hash = {name: self.class.name}
+ hash.merge!(merge_hash) if merge_hash
+ hash
end
# Get the previous layer.
def prev_layer
@model.layers[@model.layers.index(self) - 1]
@@ -192,10 +194,9 @@
@x_shape = x.shape
x.reshape(x.shape[0], *@shape)
end
def backward(dout)
- p dout.shape, @x_shape
dout.reshape(*@x_shape)
end
def to_hash
super({shape: @shape})