-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
090cb26
commit 6818fa2
Showing
41 changed files
with
611 additions
and
383 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from .base import * | ||
from .metrics import * | ||
from .modules import * | ||
from .registry import * | ||
from .tools import * | ||
|
||
__version__ = '0.1.0' |
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
from .blocks import build_block, list_blocks | ||
from .components import build_component, list_components | ||
from .layers import build_layer, list_layers | ||
from .optim import (build_lr_scheduler, build_optimizer, list_lr_schedulers, | ||
list_optimizers) | ||
from .blocks import * | ||
from .components import * | ||
from .layers import * | ||
from .ops import * | ||
from .optim import * | ||
from .power_module import PowerModule | ||
from .utils import (has_children, initialize_weights_, replace_module, | ||
replace_module_attr_value) |
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 |
---|---|---|
@@ -1,21 +1,19 @@ | ||
import fnmatch | ||
|
||
from .conv_block import Conv2dBlock, SeparableConv2dBlock | ||
|
||
# from .mamba_block import build_mamba_block | ||
# from .vit_block import build_vit_block | ||
|
||
|
||
def build_block(name, **kwargs): | ||
cls = globals().get(name, None) | ||
if cls is None: | ||
raise ValueError(f'Block named {name} is not support.') | ||
return cls(**kwargs) | ||
# def build_block(name, **kwargs): | ||
# cls = globals().get(name, None) | ||
# if cls is None: | ||
# raise ValueError(f'Block named {name} is not support.') | ||
# return cls(**kwargs) | ||
|
||
|
||
def list_blocks(filter=''): | ||
block_list = [k for k in globals().keys() if 'Block' in k] | ||
if len(filter): | ||
return fnmatch.filter(block_list, filter) # include these blocks | ||
else: | ||
return block_list | ||
# def list_blocks(filter=''): | ||
# block_list = [k for k in globals().keys() if 'Block' in k] | ||
# if len(filter): | ||
# return fnmatch.filter(block_list, filter) # include these blocks | ||
# else: | ||
# return block_list |
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 |
---|---|---|
@@ -1,29 +1,5 @@ | ||
import fnmatch | ||
|
||
from .activation import * | ||
from .dropout import * | ||
from .loss import * | ||
from .norm import * | ||
from .pooling import * | ||
|
||
|
||
def build_component_cls(name): | ||
cls = globals().get(name, None) | ||
if cls is None: | ||
raise ValueError(f'Component named {name} is not support.') | ||
return cls | ||
|
||
|
||
def build_component(name, **options): | ||
cls = globals().get(name, None) | ||
if cls is None: | ||
raise ValueError(f'Component named {name} is not support.') | ||
return cls(**options) | ||
|
||
|
||
def list_components(filter=''): | ||
component_list = [k for k in globals().keys() if 'Component' in k] | ||
if len(filter): | ||
return fnmatch.filter(component_list, filter) # include these components | ||
else: | ||
return component_list |
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
import torch.nn as nn | ||
from torch.nn import AlphaDropout, Dropout, Dropout2d, Dropout3d | ||
|
||
from ...registry import COMPONENTS | ||
|
||
__all__ = [ | ||
'Dropout', 'Dropout2d', 'Dropout3d', 'AlphaDropout', | ||
] | ||
|
||
|
||
for k in __all__: | ||
COMPONENTS.register_module(name=k, module=globals()[k]) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,5 @@ | ||
import fnmatch | ||
|
||
from .aspp import ASPP | ||
from .grl import GradientReversalLayer | ||
from .selayer import SELayer | ||
from .vae import VAE | ||
from .weighted_sum import WeightedSum | ||
|
||
|
||
def build_layer(name, **options): | ||
cls = globals().get(name, None) | ||
if cls is None: | ||
raise ValueError(f'Layer named {name} is not support.') | ||
return cls(**options) | ||
|
||
|
||
def list_layers(filter=''): | ||
layer_list = [k for k in globals().keys() if 'Layer' in k] | ||
if len(filter): | ||
return fnmatch.filter(layer_list, filter) # include these layers | ||
else: | ||
return layer_list |
Oops, something went wrong.