Skip to content

Commit

Permalink
Fixed get_mo_options_from_cfg args
Browse files Browse the repository at this point in the history
  • Loading branch information
SemyonBevzuk committed Mar 10, 2022
1 parent 2acb2a0 commit e3e1e5b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
13 changes: 5 additions & 8 deletions mmdeploy/apis/openvino/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) OpenMMLab. All rights reserved.
from typing import Dict, List, Optional
from typing import Dict, List

import mmcv

Expand Down Expand Up @@ -53,20 +53,17 @@ def get_input_info_from_cfg(deploy_cfg: mmcv.Config) -> Dict[str, List]:
return input_info


def get_mo_options_from_cfg(
deploy_cfg: Optional[mmcv.Config]) -> ModelOptimizerOptions:
def get_mo_options_from_cfg(deploy_cfg: mmcv.Config) -> ModelOptimizerOptions:
"""Get additional parameters for the Model Optimizer from the deploy
config.
Args:
deploy_cfg (None | mmcv.Config): Deployment config.
deploy_cfg (mmcv.Config): Deployment config.
Returns:
ModelOptimizerOptions: A class that will contain additional arguments.
"""
mo_options = None
if deploy_cfg:
backend_config = get_backend_config(deploy_cfg)
mo_options = backend_config.get('mo_options', None)
backend_config = get_backend_config(deploy_cfg)
mo_options = backend_config.get('mo_options', None)
mo_options = ModelOptimizerOptions(mo_options)
return mo_options
5 changes: 2 additions & 3 deletions tests/test_apis/test_onnx2openvino.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ def get_deploy_cfg_with_mo_args():
return deploy_cfg


@pytest.mark.parametrize(
'get_deploy_cfg',
[lambda: None, get_base_deploy_cfg, get_deploy_cfg_with_mo_args])
@pytest.mark.parametrize('get_deploy_cfg',
[get_base_deploy_cfg, get_deploy_cfg_with_mo_args])
@backend_checker(Backend.OPENVINO)
def test_onnx2openvino(get_deploy_cfg):
from mmdeploy.apis.openvino import (get_mo_options_from_cfg,
Expand Down

0 comments on commit e3e1e5b

Please sign in to comment.