Skip to content

Commit bcf8973

Browse files
malfetfacebook-github-bot
authored andcommitted
Add torch.utils.cmake_prefix_path pointing to share/cmake folder (#38559)
Summary: Pull Request resolved: #38559 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 Differential Revision: D21644066 Pulled By: malfet fbshipit-source-id: c8e3cb2cbd7f969fadea6a3bccc41c4edb3ec546
1 parent 363a2d9 commit bcf8973

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)