lib/torch/nn/module.rb in torch-rb-0.5.3 vs lib/torch/nn/module.rb in torch-rb-0.6.0
- old
+ new
@@ -284,9 +284,15 @@
named_parameters[name]
elsif named_buffers.key?(name)
named_buffers[name]
elsif named_modules.key?(name)
named_modules[name]
+ elsif method.end_with?("=") && named_modules.key?(method[0..-2])
+ if instance_variable_defined?("@#{method[0..-2]}")
+ instance_variable_set("@#{method[0..-2]}", *args)
+ else
+ raise NotImplementedYet
+ end
else
super
end
end