Mock out torch in docs
@@ -18,6 +18,17 @@ sys.path.append(os.path.abspath(os.path.join(__file__, '..', '..', '..')))
print(sys.path)
import sphinx_rtd_theme
+# Mock
+from unittest.mock import MagicMock
+
+class Mock(MagicMock):
+ @classmethod
+ def __getattr__(cls, name):
+ return MagicMock()
+
+MOCK_MODULES = ['torch']
+sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
+
# -- Project information -----------------------------------------------------
