Skip to content

Commit ee80a7f

Browse files
Fix tensor disposal (#6028)
* Upgraded to Sentis 1.3.0-pre.2 * Fixed tensor disposal bug in ModelRunner.
1 parent 209d258 commit ee80a7f

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

Project/Packages/packages-lock.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"depth": 0,
7373
"source": "local",
7474
"dependencies": {
75-
"com.unity.sentis": "1.3.0-pre.1",
75+
"com.unity.sentis": "1.3.0-pre.2",
7676
"com.unity.modules.imageconversion": "1.0.0",
7777
"com.unity.modules.jsonserialize": "1.0.0",
7878
"com.unity.modules.physics": "1.0.0"
@@ -104,7 +104,7 @@
104104
"url": "https://packages.unity.com"
105105
},
106106
"com.unity.sentis": {
107-
"version": "1.3.0-pre.1",
107+
"version": "1.3.0-pre.2",
108108
"depth": 1,
109109
"source": "registry",
110110
"dependencies": {

com.unity.ml-agents/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ and this project adheres to
2222

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

2627
#### ml-agents / ml-agents-envs
2728
- Bumped numpy version to >=1.21.2,<1.24.0 (#5997)

com.unity.ml-agents/Runtime/Inference/ModelRunner.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ public void Dispose()
150150
if (m_Engine != null)
151151
m_Engine.Dispose();
152152
m_TensorAllocator?.Reset(false);
153+
foreach (var (name, tensor) in m_InputsByName)
154+
{
155+
tensor.Dispose();
156+
}
153157
}
154158

155159
void FetchSentisOutputs(string[] names)

0 commit comments

Comments
 (0)