summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorPeter Goldsborough <psag@fb.com>2018-10-26 15:40:19 -0700
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2018-10-26 15:44:51 -0700
commit80f766e5cd8c55684de9aa9967fb55b1e2ab1c18 (patch)
tree95a1477341935314d398dc1be86227a9eb0a80a4 /docs
parenteea2ee6d29aeb68c06066ee8bbdf0df43b308521 (diff)
downloadpytorch-80f766e5cd8c55684de9aa9967fb55b1e2ab1c18.tar.gz
pytorch-80f766e5cd8c55684de9aa9967fb55b1e2ab1c18.tar.bz2
pytorch-80f766e5cd8c55684de9aa9967fb55b1e2ab1c18.zip
Create FAQ (#13129)
Summary: Creates a FAQ. https://github.com/pytorch/tutorials/pull/345 now just links to this page. soumith ezyang Pull Request resolved: https://github.com/pytorch/pytorch/pull/13129 Differential Revision: D10854264 Pulled By: goldsborough fbshipit-source-id: 6e57574ffa61409d4d9d1750aa618893b897ad41
Diffstat (limited to 'docs')
-rw-r--r--docs/cpp/source/faq.rst34
-rw-r--r--docs/cpp/source/index.rst1
2 files changed, 35 insertions, 0 deletions
diff --git a/docs/cpp/source/faq.rst b/docs/cpp/source/faq.rst
new file mode 100644
index 0000000000..37a1a609f3
--- /dev/null
+++ b/docs/cpp/source/faq.rst
@@ -0,0 +1,34 @@
+FAQ
+---
+
+Listed below are a number of common issues users face with the various parts of
+the C++ API.
+
+C++ Extensions
+==============
+
+Undefined symbol errors from PyTorch/ATen
+*****************************************
+
+**Problem**: You import your extension and get an ``ImportError`` stating that
+some C++ symbol from PyTorch or ATen is undefined. For example::
+
+ >>> import extension
+ Traceback (most recent call last):
+ File "<stdin>", line 1, in <module>
+ ImportError: /home/user/.pyenv/versions/3.7.1/lib/python3.7/site-packages/extension.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN2at19UndefinedTensorImpl10_singletonE
+
+**Fix**: The fix is to ``import torch`` before you import your extension. This will make
+the symbols from the PyTorch dynamic (shared) library that your extension
+depends on available, allowing them to be resolved once you import your extension.
+
+I created a tensor using a function from ``at::`` and get errors
+****************************************************************
+
+**Problem**: You created a tensor using e.g. ``at::ones`` or ``at::randn`` or
+any other tensor factory from the ``at::`` namespace and are getting errors.
+
+**Fix**: Replace ``at::`` with ``torch::`` for factory function calls. You
+should never use factory functions from the ``at::`` namespace, as they will
+create tensors. The corresponding ``torch::`` functions will create variables,
+and you should only ever deal with variables in your code.
diff --git a/docs/cpp/source/index.rst b/docs/cpp/source/index.rst
index 803d2c67bf..64e83e1a1d 100644
--- a/docs/cpp/source/index.rst
+++ b/docs/cpp/source/index.rst
@@ -161,6 +161,7 @@ Contents
frontend
installing
+ faq
contributing
api/library_root