forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add warning when importing caffe2 on build without BUILD_CAFFE2=1
Confusing backtraces are issued to users when they run Caffe2 scripts (or tests) on PyTorch builds without Caffe2 enabled through `BUILD_CAFFE2=1` This PR adds warnings (in more than one place) to return a friendly message for the user, helping them to overcome the problem by themselves Pull Request resolved: pytorch#73770 Approved by: https://github.com/BowenBao, https://github.com/malfet, https://github.com/garymm
- Loading branch information
1 parent
bf730e5
commit e071340
Showing
4 changed files
with
27 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import warnings | ||
from torch.onnx import _CAFFE2_ATEN_FALLBACK | ||
|
||
if not _CAFFE2_ATEN_FALLBACK: | ||
warnings.warn("Caffe2 support is not fully enabled in this PyTorch build. " | ||
"Please enable Caffe2 by building PyTorch from source with `BUILD_CAFFE2=1` flag.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters