Skip to content

Commit

Permalink
Removed non-persistent buffers from state_dict [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Aug 6, 2024
1 parent 613e6b8 commit b509c33
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/torch/nn/module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,10 @@ def save_to_state_dict(destination, prefix: "")
destination[prefix + k] = v
end
named_buffers.each do |k, v|
destination[prefix + k] = v
# TODO exclude v.nil?
if !@non_persistent_buffers_set.include?(k)
destination[prefix + k] = v
end
end
end

Expand Down

0 comments on commit b509c33

Please sign in to comment.