Skip to content

Commit

Permalink
Fix tensor disposal (#6028)
Browse files Browse the repository at this point in the history
* Upgraded to Sentis 1.3.0-pre.2

* Fixed tensor disposal bug in ModelRunner.
  • Loading branch information
miguelalonsojr authored Nov 30, 2023
1 parent 209d258 commit ee80a7f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Project/Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"depth": 0,
"source": "local",
"dependencies": {
"com.unity.sentis": "1.3.0-pre.1",
"com.unity.sentis": "1.3.0-pre.2",
"com.unity.modules.imageconversion": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.physics": "1.0.0"
Expand Down Expand Up @@ -104,7 +104,7 @@
"url": "https://packages.unity.com"
},
"com.unity.sentis": {
"version": "1.3.0-pre.1",
"version": "1.3.0-pre.2",
"depth": 1,
"source": "registry",
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions com.unity.ml-agents/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to

### Bug Fixes
#### com.unity.ml-agents / com.unity.ml-agents.extensions (C#)
- Fixed missing tensor Dispose in ModelRunner (#)

#### ml-agents / ml-agents-envs
- Bumped numpy version to >=1.21.2,<1.24.0 (#5997)
Expand Down
4 changes: 4 additions & 0 deletions com.unity.ml-agents/Runtime/Inference/ModelRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ public void Dispose()
if (m_Engine != null)
m_Engine.Dispose();
m_TensorAllocator?.Reset(false);
foreach (var (name, tensor) in m_InputsByName)
{
tensor.Dispose();
}
}

void FetchSentisOutputs(string[] names)
Expand Down

0 comments on commit ee80a7f

Please sign in to comment.