Matlab crashes when importing pytorch library
조회 수: 4 (최근 30일)
이전 댓글 표시
I'm calling user-defined python module from matlab script that includes PyTorch library. The following line crashes Matlab:
def myfunc():
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
Any ideas on how to fix this?
Thanks in advance
댓글 수: 0
답변 (1개)
Vignesh Murugavel
2021년 8월 1일
Using out-of-process execution mode will avoid these conflicts. For this reason, using out-of-process mode is the best practice when using the Python Interface. Use the pyenv command to run in out-of-process mode.
>> pyenv("Version","<path to python executable>", "ExecutionMode", "OutOfProcess")
참고 항목
카테고리
Help Center 및 File Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!