Skip to content

Commit

Permalink
[Doc] fix docserver build for tutorials (dmlc#2518)
Browse files Browse the repository at this point in the history
* fix doc build

* hide GPU code
  • Loading branch information
BarclayII authored Jan 12, 2021
1 parent 5d4995e commit 498505b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
10 changes: 9 additions & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,20 @@ pytorch:
@echo "##################################################################"
@DGLBACKEND=pytorch DGL_LOADALL=true $(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

tensorflow:
@echo "##################################################################"
@echo "# #"
@echo "# Step 3: Building Tensorflow tutorials #"
@echo "# #"
@echo "##################################################################"
@DGLBACKEND=tensorflow DGL_LOADALL=true $(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

html-noexec:
DGL_LOADALL=true $(SPHINXBUILD) -D plot_gallery=0 -b html "$(SOURCEDIR)" "$(BUILDDIR)/html"
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

html: Makefile mxnet pytorch
html: Makefile mxnet pytorch tensorflow

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
Expand Down
10 changes: 6 additions & 4 deletions new-tutorial/1_introduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,12 @@ def train(g, model):
# Training on GPU requires to put both the model and the graph onto GPU
# with the ``to`` method, similar to what you will do in PyTorch.
#

g = g.to('cuda')
model = GCN(g.ndata['feat'].shape[1], 16, dataset.num_classes).to('cuda')
train(g, model)
# .. code:: python
#
# g = g.to('cuda')
# model = GCN(g.ndata['feat'].shape[1], 16, dataset.num_classes).to('cuda')
# train(g, model)
#


######################################################################
Expand Down
10 changes: 1 addition & 9 deletions python/dgl/nn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,4 @@ def _load_backend(mod_name):
for api, obj in mod.__dict__.items():
setattr(thismod, api, obj)


LOAD_ALL = os.getenv("DGL_LOADALL", "False")

if LOAD_ALL.lower() != "false":
from .mxnet import *
from .pytorch import *
from .tensorflow import *
else:
_load_backend(backend_name)
_load_backend(backend_name)

0 comments on commit 498505b

Please sign in to comment.