[Fix] Use local ATTENTION registery to avoid conflict with other repo. (#375)

pull/370/head^2
Ma Zerun 2021-07-27 05:59:05 -04:00 committed by GitHub
parent 0f4cae4d3f
commit 33a4c0fe9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -1,4 +1,5 @@
from mmcv.cnn import MODELS as MMCV_MODELS from mmcv.cnn import MODELS as MMCV_MODELS
from mmcv.cnn.bricks.registry import ATTENTION as MMCV_ATTENTION
from mmcv.utils import Registry from mmcv.utils import Registry
MODELS = Registry('models', parent=MMCV_MODELS) MODELS = Registry('models', parent=MMCV_MODELS)
@ -9,6 +10,8 @@ HEADS = MODELS
LOSSES = MODELS LOSSES = MODELS
CLASSIFIERS = MODELS CLASSIFIERS = MODELS
ATTENTION = Registry('attention', parent=MMCV_ATTENTION)
def build_backbone(cfg): def build_backbone(cfg):
"""Build backbone.""" """Build backbone."""

View File

@ -1,11 +1,11 @@
import torch import torch
import torch.nn as nn import torch.nn as nn
import torch.nn.functional as F import torch.nn.functional as F
from mmcv.cnn.bricks.registry import ATTENTION
from mmcv.cnn.bricks.transformer import build_dropout from mmcv.cnn.bricks.transformer import build_dropout
from mmcv.cnn.utils.weight_init import trunc_normal_ from mmcv.cnn.utils.weight_init import trunc_normal_
from mmcv.runner.base_module import BaseModule from mmcv.runner.base_module import BaseModule
from ..builder import ATTENTION
from .helpers import to_2tuple from .helpers import to_2tuple