From 0683b50d613cf1e807d47e1b39bea7e880f11fda Mon Sep 17 00:00:00 2001 From: Kai Chen <chenkaidev@gmail.com> Date: Wed, 26 Sep 2018 17:04:37 +0800 Subject: [PATCH] mmdet.nn.parallel -> mmdet.core.parallel --- mmdet/core/__init__.py | 1 + mmdet/{nn => core}/parallel/__init__.py | 0 mmdet/{nn => core}/parallel/_functions.py | 0 mmdet/{nn => core}/parallel/data_parallel.py | 0 mmdet/{nn => core}/parallel/distributed.py | 0 mmdet/{nn => core}/parallel/scatter_gather.py | 3 ++- mmdet/core/utils/hooks.py | 4 ++-- mmdet/nn/__init__.py | 1 - tools/test.py | 3 +-- tools/train.py | 4 ++-- 10 files changed, 8 insertions(+), 8 deletions(-) rename mmdet/{nn => core}/parallel/__init__.py (100%) rename mmdet/{nn => core}/parallel/_functions.py (100%) rename mmdet/{nn => core}/parallel/data_parallel.py (100%) rename mmdet/{nn => core}/parallel/distributed.py (100%) rename mmdet/{nn => core}/parallel/scatter_gather.py (99%) delete mode 100644 mmdet/nn/__init__.py diff --git a/mmdet/core/__init__.py b/mmdet/core/__init__.py index 0327750..1eb03f7 100644 --- a/mmdet/core/__init__.py +++ b/mmdet/core/__init__.py @@ -3,5 +3,6 @@ from .bbox_ops import * from .mask_ops import * from .losses import * from .eval import * +from .parallel import * from .post_processing import * from .utils import * diff --git a/mmdet/nn/parallel/__init__.py b/mmdet/core/parallel/__init__.py similarity index 100% rename from mmdet/nn/parallel/__init__.py rename to mmdet/core/parallel/__init__.py diff --git a/mmdet/nn/parallel/_functions.py b/mmdet/core/parallel/_functions.py similarity index 100% rename from mmdet/nn/parallel/_functions.py rename to mmdet/core/parallel/_functions.py diff --git a/mmdet/nn/parallel/data_parallel.py b/mmdet/core/parallel/data_parallel.py similarity index 100% rename from mmdet/nn/parallel/data_parallel.py rename to mmdet/core/parallel/data_parallel.py diff --git a/mmdet/nn/parallel/distributed.py b/mmdet/core/parallel/distributed.py similarity index 100% rename from mmdet/nn/parallel/distributed.py rename to mmdet/core/parallel/distributed.py diff --git a/mmdet/nn/parallel/scatter_gather.py b/mmdet/core/parallel/scatter_gather.py similarity index 99% rename from mmdet/nn/parallel/scatter_gather.py rename to mmdet/core/parallel/scatter_gather.py index f5f7c58..02849dc 100644 --- a/mmdet/nn/parallel/scatter_gather.py +++ b/mmdet/core/parallel/scatter_gather.py @@ -1,6 +1,7 @@ import torch -from ._functions import Scatter from torch.nn.parallel._functions import Scatter as OrigScatter + +from ._functions import Scatter from mmdet.datasets.utils import DataContainer diff --git a/mmdet/core/utils/hooks.py b/mmdet/core/utils/hooks.py index 0544160..9772d4d 100644 --- a/mmdet/core/utils/hooks.py +++ b/mmdet/core/utils/hooks.py @@ -7,11 +7,11 @@ import mmcv import numpy as np import torch from mmcv.torchpack import Hook -from mmdet.datasets.loader import collate -from mmdet.nn.parallel import scatter from pycocotools.cocoeval import COCOeval from ..eval import eval_recalls +from ..parallel import scatter +from mmdet.datasets.loader import collate class EmptyCacheHook(Hook): diff --git a/mmdet/nn/__init__.py b/mmdet/nn/__init__.py deleted file mode 100644 index 1b627f5..0000000 --- a/mmdet/nn/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .parallel import MMDataParallel, MMDistributedDataParallel diff --git a/tools/test.py b/tools/test.py index 773136d..0a43cdc 100644 --- a/tools/test.py +++ b/tools/test.py @@ -5,10 +5,9 @@ import mmcv from mmcv.torchpack import load_checkpoint, parallel_test, obj_from_dict from mmdet import datasets -from mmdet.core import results2json, coco_eval +from mmdet.core import scatter, MMDataParallel, results2json, coco_eval from mmdet.datasets.loader import collate, build_dataloader from mmdet.models import build_detector, detectors -from mmdet.nn.parallel import scatter, MMDataParallel def single_test(model, data_loader, show=False): diff --git a/tools/train.py b/tools/train.py index 8fd4380..fd47b13 100644 --- a/tools/train.py +++ b/tools/train.py @@ -8,10 +8,10 @@ from mmcv import Config from mmcv.torchpack import Runner, obj_from_dict from mmdet import datasets -from mmdet.core import init_dist, DistOptimizerHook, DistSamplerSeedHook +from mmdet.core import (init_dist, DistOptimizerHook, DistSamplerSeedHook, + MMDataParallel, MMDistributedDataParallel) from mmdet.datasets.loader import build_dataloader from mmdet.models import build_detector -from mmdet.nn.parallel import MMDataParallel, MMDistributedDataParallel def parse_losses(losses): -- GitLab