Skip to content

Commit

Permalink
[Feature] Import subpackge based on backend of dgl.nn (dmlc#1305)
Browse files Browse the repository at this point in the history
* automatically select nn backend

* rename load_backend to private

* switch to backend_name

Co-authored-by: Jinjing Zhou <[email protected]>
  • Loading branch information
VoVAllen authored Mar 5, 2020
1 parent 93ac29c commit e2db791
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 0 additions & 1 deletion python/dgl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from .backend import load_backend

from . import function
from . import nn
from . import contrib
from . import container
from . import random
Expand Down
11 changes: 11 additions & 0 deletions python/dgl/nn/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
"""Package for neural network common components."""
import importlib
import sys
from ..backend import backend_name

def _load_backend(mod_name):
mod = importlib.import_module('.%s' % mod_name, __name__)
thismod = sys.modules[__name__]
for api, obj in mod.__dict__.items():
setattr(thismod, api, obj)

_load_backend(backend_name)

0 comments on commit e2db791

Please sign in to comment.