mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-27 20:02:15 +00:00
Don't hold onto unnecessary numpy references while binding numpy objectas as inputs (#7881)
This commit is contained in:
parent
d8bcb3d6a4
commit
3a72932c4a
1 changed files with 2 additions and 2 deletions
|
|
@ -355,7 +355,7 @@ class IOBinding:
|
|||
'''
|
||||
def __init__(self, session):
|
||||
self._iobinding = C.SessionIOBinding(session._sess)
|
||||
self._numpy_obj_references = []
|
||||
self._numpy_obj_references = {}
|
||||
|
||||
def bind_cpu_input(self, name, arr_on_cpu):
|
||||
'''
|
||||
|
|
@ -366,7 +366,7 @@ class IOBinding:
|
|||
# Hold a reference to the numpy object as the bound OrtValue is backed
|
||||
# directly by the data buffer of the numpy object and so the numpy object
|
||||
# must be around until this IOBinding instance is around
|
||||
self._numpy_obj_references.append(arr_on_cpu)
|
||||
self._numpy_obj_references[name] = arr_on_cpu
|
||||
self._iobinding.bind_input(name, arr_on_cpu)
|
||||
|
||||
def bind_input(self, name, device_type, device_id, element_type, shape, buffer_ptr):
|
||||
|
|
|
|||
Loading…
Reference in a new issue