mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Fix code portability when looking for Dot (#153259)
When trying to plot a trace graph, Inductor checks if "dot" is installed. Currently, the code runs a "which dot" command. By default, Windows doesn't have the "which" command. This patch replaces it with the more portable alternative. Pull Request resolved: https://github.com/pytorch/pytorch/pull/153259 Approved by: https://github.com/Skylion007
This commit is contained in:
parent
01cbf5a30a
commit
6a84fe65ec
|
|
@ -12,7 +12,6 @@ import os.path
|
|||
import pickle
|
||||
import pstats
|
||||
import shutil
|
||||
import subprocess
|
||||
import traceback
|
||||
from collections.abc import Iterator
|
||||
from typing import Any, Callable, IO, Optional, Union
|
||||
|
|
@ -53,11 +52,7 @@ GRAPHVIZ_COMMAND_SCALABLE = ["dot", "-Gnslimit=2", "-Gnslimit1=2", "-Gmaxiter=50
|
|||
|
||||
@functools.lru_cache(None)
|
||||
def has_dot() -> bool:
|
||||
try:
|
||||
subprocess.check_output(["which", "dot"], stderr=subprocess.PIPE)
|
||||
return True
|
||||
except subprocess.SubprocessError:
|
||||
return False
|
||||
return shutil.which("dot") is not None
|
||||
|
||||
|
||||
def draw_buffers(
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user