Skip to content

Commit 6151d67

Browse files
committed
Fix bug with Tensor.backward
Fixing reversed graph parameters.
1 parent 1dd3ae5 commit 6151d67

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/TorchSharp/Tensor/Tensor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,8 +697,8 @@ public bool is_sparse {
697697
}
698698
}
699699

700-
public void backward(IList<Tensor>? grad_tensors = null, bool create_graph = false, bool retain_graph = false, IList<Tensor>? inputs = null) =>
701-
torch.autograd.backward(new[] { this }, grad_tensors, create_graph, retain_graph, inputs);
700+
public void backward(IList<Tensor>? grad_tensors = null, bool retain_graph = false, bool create_graph = false, IList<Tensor>? inputs = null) =>
701+
torch.autograd.backward(new[] { this }, grad_tensors, retain_graph, create_graph, inputs);
702702

703703
/// <summary>
704704
/// Creates a tensor by loading it from a file.

0 commit comments

Comments
 (0)