lib/torch/nn/utils.rb in torch-rb-0.8.2 vs lib/torch/nn/utils.rb in torch-rb-0.8.3

- old
+ new

@@ -20,14 +20,10 @@ def _ntuple(n, value) value.is_a?(Array) ? value : [value] * n end def _clones(mod, n) - state = mod.state_dict - layers = n.times.map do |i| - mod.clone.tap { |l| l.load_state_dict(state) } - end - ModuleList.new(layers) + ModuleList.new(n.times.map { mod.deep_dup }) end def _activation_fn(activation) case activation.to_sym when :relu then F.method(:relu)