浏览代码

Add global lock for torch.onnx.export() (#4665)

* Cherry-pick fix from #4659
/release_10_branch
GitHub 4 年前
当前提交
8df04e83
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6
      ml-agents/mlagents/trainers/torch/model_serialization.py

6
ml-agents/mlagents/trainers/torch/model_serialization.py


This implementation is thread safe.
"""
# local is_exporting flag for each thread
# global lock shared among all threads, to make sure only one thread is exporting at a time
_lock = threading.Lock()
self._lock.acquire()
self._lock.release()
@staticmethod
def is_exporting():

正在加载...
取消
保存