summaryrefslogtreecommitdiff
path: root/torch/_thnn
diff options
context:
space:
mode:
authoranderspapitto <anderspapitto@gmail.com>2018-06-12 14:57:29 -0700
committerGitHub <noreply@github.com>2018-06-12 14:57:29 -0700
commitfcd9af8a257f83450ba82cccd227fe43bde7c879 (patch)
tree49968013bdc5aa8c44e6989cf9d26f4c5474321e /torch/_thnn
parentffffee6aa99331fb6bed453009350805615499a0 (diff)
downloadpytorch-fcd9af8a257f83450ba82cccd227fe43bde7c879.tar.gz
pytorch-fcd9af8a257f83450ba82cccd227fe43bde7c879.tar.bz2
pytorch-fcd9af8a257f83450ba82cccd227fe43bde7c879.zip
changes to support ATen code generation inside fbcode (#8397)
* Back out "Back out "Add support for generating ATen files during fbcode build"" Original commit changeset: 7b8de22d1613 I'm re-sending this diff exactly as it was approved and committed. Fixes to support @mode/opt will be sent separately for ease of review. * Enable building //caffe2:torch with @mode/opt In @mode/opt, python runs out of a PAR, which breaks a lot of assumptions in the code about where templates/ folders live relative to __file__. Rather than introduce hacks with parutil, I simply turn template_path into a parameter for all the relevant functions and thread it through from the top level.
Diffstat (limited to 'torch/_thnn')
-rw-r--r--torch/_thnn/utils.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/torch/_thnn/utils.py b/torch/_thnn/utils.py
index ab164e02e6..84c93a8180 100644
--- a/torch/_thnn/utils.py
+++ b/torch/_thnn/utils.py
@@ -2,8 +2,12 @@ import os
import itertools
import importlib
-THNN_H_PATH = os.path.join(os.path.dirname(__file__), '..', 'lib', 'THNN.h')
-THCUNN_H_PATH = os.path.join(os.path.dirname(__file__), '..', 'lib', 'THCUNN.h')
+# in fbcode, this fails in some cases, but we don't need it, therefore the try-catch
+try:
+ THNN_H_PATH = os.path.join(os.path.dirname(__file__), '..', 'lib', 'THNN.h')
+ THCUNN_H_PATH = os.path.join(os.path.dirname(__file__), '..', 'lib', 'THCUNN.h')
+except Exception:
+ pass
def _unpickle_backend(backend_name):