-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix bc break of mmdet.core.fp16, refactor import of wrap_fp16_model * changed warning method * added docstring for Depr_Fp16OptimizerHook * docformatter * fix docstring * changed names from depr to deprecated
- Loading branch information
Showing
7 changed files
with
63 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from .anchor import * # noqa: F401, F403 | ||
from .bbox import * # noqa: F401, F403 | ||
from .evaluation import * # noqa: F401, F403 | ||
from .fp16 import * # noqa: F401, F403 | ||
from .mask import * # noqa: F401, F403 | ||
from .post_processing import * # noqa: F401, F403 | ||
from .utils import * # noqa: F401, F403 |
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,8 @@ | ||
from .deprecated_fp16_utils import \ | ||
DeprecatedFp16OptimizerHook as Fp16OptimizerHook | ||
from .deprecated_fp16_utils import deprecated_auto_fp16 as auto_fp16 | ||
from .deprecated_fp16_utils import deprecated_force_fp32 as force_fp32 | ||
from .deprecated_fp16_utils import \ | ||
deprecated_wrap_fp16_model as wrap_fp16_model | ||
|
||
__all__ = ['auto_fp16', 'force_fp32', 'Fp16OptimizerHook', 'wrap_fp16_model'] |
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,47 @@ | ||
import warnings | ||
|
||
from mmcv.runner import (Fp16OptimizerHook, auto_fp16, force_fp32, | ||
wrap_fp16_model) | ||
|
||
|
||
class DeprecatedFp16OptimizerHook(Fp16OptimizerHook): | ||
"""A wrapper class for the FP16 optimizer hook. This class wraps | ||
:class:`Fp16OptimizerHook` in `mmcv.runner` and shows a warning that the | ||
:class:`Fp16OptimizerHook` from `mmdet.core` will be deprecated. | ||
Refer to :class:`Fp16OptimizerHook` in `mmcv.runner` for more details. | ||
Args: | ||
loss_scale (float): Scale factor multiplied with loss. | ||
""" | ||
|
||
def __init__(*args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
warnings.warn( | ||
'Importing Fp16OptimizerHook from "mmdet.core" will be ' | ||
'deprecated in the future. Please import them from "mmcv.runner" ' | ||
'instead') | ||
|
||
|
||
def deprecated_auto_fp16(*args, **kwargs): | ||
warnings.warn( | ||
'Importing auto_fp16 from "mmdet.core" will be ' | ||
'deprecated in the future. Please import them from "mmcv.runner" ' | ||
'instead') | ||
return auto_fp16(*args, **kwargs) | ||
|
||
|
||
def deprecated_force_fp32(*args, **kwargs): | ||
warnings.warn( | ||
'Importing force_fp32 from "mmdet.core" will be ' | ||
'deprecated in the future. Please import them from "mmcv.runner" ' | ||
'instead') | ||
return force_fp32(*args, **kwargs) | ||
|
||
|
||
def deprecated_wrap_fp16_model(*args, **kwargs): | ||
warnings.warn( | ||
'Importing wrap_fp16_model from "mmdet.core" will be ' | ||
'deprecated in the future. Please import them from "mmcv.runner" ' | ||
'instead') | ||
wrap_fp16_model(*args, **kwargs) |
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