Skip to content

Commit aa12c81

Browse files
committed
Add torch.utils.cmake_prefix_path pointing to share/cmake folder
Test Plan: Make sure that `cmake path/to/CMakeLists.txt -DCMAKE_PREFIX_PATH=`python -c 'import torch;print(torch.utils.cmake_prefix_path)'` succeeds for CMake projects which depends on Torch package
1 parent 42a3fb3 commit aa12c81

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

torch/utils/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22

33
from .throughput_benchmark import ThroughputBenchmark
44

5+
import os.path as _osp
6+
57
# Set the module for a given object for nicer printing
68
def set_module(obj, mod):
79
if not isinstance(mod, str):
810
raise TypeError("The mod argument should be a string")
911
obj.__module__ = mod
12+
13+
#: Path to folder containing CMake definitions for Torch package
14+
cmake_prefix_path = _osp.join(_osp.dirname(_osp.dirname(__file__)), 'share', 'cmake')

0 commit comments

Comments
 (0)