Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Are not you leaking tensors left and right in your samples #55

Unanswered
gevorgter asked this question in Q&A
Discussion options

Looking at https://github.com/dotnet/TorchSharpExamples/blob/main/tutorials/CSharp/tutorial6.ipynb
lines like this one: loss.forward(model.forward(dataBatch), resultBatch);
model.forward() returns tensor and you never do Dispose on it.

Or am i missing something?
my understanding that Tensor live in PyTorch library and will not put pressure on C# garbage collection.
line like this "model.forward(dataBatch).argmax(1)" in a loop 1000 times leaks 1000 tensors and GC will not know that it's time to collect them.

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /