lib/dnn/core/layers.rb in ruby-dnn-0.6.6 vs lib/dnn/core/layers.rb in ruby-dnn-0.6.7

- old
+ new

@@ -7,12 +7,12 @@ @built = false end # Build the layer. def build(model) - @built = true @model = model + @built = true end # Does the layer have already been built? def built? @built @@ -36,11 +36,11 @@ hash end # Get the previous layer. def prev_layer - @model.layers[@model.layers.index(self) - 1] + @model.get_prev_layer(self) end end # This class is a superclass of all classes with learning parameters. @@ -55,11 +55,14 @@ @grads = {} @trainable = true end def build(model) - super - init_params + @model = model + unless @built + @built = true + init_params + end end # Update the parameters. def update @model.optimizer.update(self) if @trainable