lib/dnn/core/layers.rb in ruby-dnn-0.1.4 vs lib/dnn/core/layers.rb in ruby-dnn-0.1.5

- old
+ new

@@ -117,11 +117,14 @@ @bias_initializer.init_param(self, :bias) end end + #private module module Convert + private + def im2col(img, out_h, out_w, fh, fw, strides) bs, fn = img.shape[0..1] col = SFloat.zeros(bs, fn, fh, fw, out_h, out_w) (0...fh).each do |i| i_range = (i...(i + strides[0] * out_h)).step(strides[0]).to_a @@ -301,10 +304,10 @@ class OutputLayer < Layer private def ridge - @model.layers.select { |layer| layer.is_a?(Dense) } + @model.layers.select { |layer| layer.respond_to?(:weight_decay) } .reduce(0) { |sum, layer| layer.weight_decay * (layer.params[:weight]**2).sum } end end