-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from kornia/reduce_dependencies
remove torch and numpy dependencies of limbus
- Loading branch information
Showing
11 changed files
with
140 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"""Configuration file for Limbus. | ||
Usage: | ||
Before importing any other Limbus module, set the COMPONENT_TYPE variable as: | ||
> from limbus_config import config | ||
> config.COMPONENT_TYPE = "torch" | ||
""" | ||
|
||
COMPONENT_TYPE = "generic" # generic or torch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""Config tests.""" | ||
import sys | ||
|
||
from torch import nn | ||
|
||
|
||
def remove_limbus_imports(): | ||
"""Remove limbus dependencies from sys.modules.""" | ||
for key in list(sys.modules.keys()): | ||
if key.startswith("limbus"): | ||
del sys.modules[key] | ||
|
||
|
||
def test_torch_base_class(): | ||
remove_limbus_imports() | ||
from limbus_config import config | ||
config.COMPONENT_TYPE = "torch" | ||
import limbus | ||
mro = limbus.Component.__mro__ | ||
remove_limbus_imports() | ||
assert len(mro) == 3 | ||
assert nn.Module in mro | ||
|
||
|
||
def test_generic_base_class(): | ||
remove_limbus_imports() | ||
import limbus | ||
mro = limbus.Component.__mro__ | ||
remove_limbus_imports() | ||
assert len(mro) == 2 | ||
assert nn.Module not in mro |