lib/dnn/core/layers.rb in ruby-dnn-0.8.4 vs lib/dnn/core/layers.rb in ruby-dnn-0.8.5
- old
+ new
@@ -273,25 +273,25 @@
def loss(x)
raise NotImplementedError.new("Class '#{self.class.name}' has implement method 'forward'")
end
def dloss
- @model.layers.select { |layer| layer.is_a?(Connection) }.each do |layer|
+ @model.get_all_layers.select { |layer| layer.is_a?(Connection) }.each do |layer|
layer.dlasso
layer.dridge
end
end
private
def lasso
- @model.layers.select { |layer| layer.is_a?(Connection) }
- .reduce(0) { |sum, layer| sum + layer.lasso }
+ @model.get_all_layers.select { |layer| layer.is_a?(Connection) }
+ .reduce(0) { |sum, layer| sum + layer.lasso }
end
def ridge
- @model.layers.select { |layer| layer.is_a?(Connection) }
- .reduce(0) { |sum, layer| sum + layer.ridge }
+ @model.get_all_layers.select { |layer| layer.is_a?(Connection) }
+ .reduce(0) { |sum, layer| sum + layer.ridge }
end
end
class Dropout < Layer