lib/torch/nn/module.rb in torch-rb-0.2.5 vs lib/torch/nn/module.rb in torch-rb-0.2.6
- old
+ new
@@ -143,10 +143,10 @@
def named_parameters(prefix: "", recurse: true)
params = {}
if recurse
named_children.each do |name, mod|
- params.merge!(mod.named_parameters(prefix: "#{name}.", recurse: recurse))
+ params.merge!(mod.named_parameters(prefix: "#{prefix}#{name}.", recurse: recurse))
end
end
instance_variables.each do |name|
param = instance_variable_get(name)
params[[prefix, name[1..-1]].join] = param if param.is_a?(Parameter)