Skip to content

Commit 03d5cf5

Browse files
author
Masaru Kimura
committed
Try to fix build failure on ubuntu & mac.
1 parent 95bf220 commit 03d5cf5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Native/LibTorchSharp/THSJIT.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void THSJIT_Module_zero_grad(const JITModule module, bool set_to_none)
7474
// torch::jit::Module has no zero_grad().
7575
// As a workaround, manually loop over the parameters and zero them out like optimizer does;
7676
// https://github.com/pytorch/pytorch/blob/v2.5.1/torch/csrc/api/src/optim/optimizer.cpp#L123
77-
for (auto& p : (*module)->parameters()) {
77+
for (const auto& p : (*module)->parameters()) {
7878
if (p.mutable_grad().defined()) {
7979
p.mutable_grad().detach_();
8080
if (set_to_none)

0 commit comments

Comments
 (0)