2.3K Star 8K Fork 4.2K

GVPMindSpore / mindspore

 / 详情

[CT][MS][OP][quant] the op of pad's tips for abnormal information is not right

DONE
Bug-Report
Opened this issue  
2020-10-22 18:01
name about labels
Bug Report Use this template for reporting a bug kind/bug

Environment

  • Hardware Environment(Ascend/GPU/CPU):

Uncomment only one /device <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/device ascend

  • Software Environment:
    -- MindSpore version (source or binary):
    -- Python version (e.g., Python 3.7.5):
    -- OS platform and distribution (e.g., Linux Ubuntu 16.04):
    -- GCC/Compiler version (if compiled from source):

Related testcase

def test_padding_input_shape_1d():
    fact = PaddingFactory(input_shape=(1,), pad_dim_size=7, dtype=np.float32)
    with pytest.raises(ValueError) as err:
    fact.forward_mindspore_impl()
        assert "must >" in str(err)

Steps to reproduce the issue

  1. pytest -s test_padding.py::test_padding_input_shape_1d

Describe the current behavior

../share/ops/padding_ops.py:30: in forward_mindspore_impl
    out = net(input)
../share/utils.py:127: in __call__
    out = super().__call__(*args, **kwargs )
/root/archiconda3/envs/liwuxia_vm/lib/python3.7/site-packages/mindspore/nn/cell.py:279: in __call__
    out = self.compile_and_run(*inputs)
/root/archiconda3/envs/liwuxia_vm/lib/python3.7/site-packages/mindspore/nn/cell.py:533: in compile_and_run
    self.compile(*inputs)
/root/archiconda3/envs/liwuxia_vm/lib/python3.7/site-packages/mindspore/nn/cell.py:520: in compile
    _executor.compile(self, *inputs, phase=self.phase, auto_parallel_mode=self._auto_parallel_mode)
/root/archiconda3/envs/liwuxia_vm/lib/python3.7/site-packages/mindspore/common/api.py:411: in compile
    result = self._executor.compile(obj, args_list, phase, use_vm)
/root/archiconda3/envs/liwuxia_vm/lib/python3.7/site-packages/mindspore/ops/operations/array_ops.py:739: in __infer__
    validator.check_int(len(x_shape), 1, Rel.GT, "rank of x", self.name)
/root/archiconda3/envs/liwuxia_vm/lib/python3.7/site-packages/mindspore/_checkparam.py:181: in check_int
    return check_number(arg_value, value, rel, int, arg_name, prim_name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

arg_value = 1, value = 1, rel = <Rel.GT: 5>, arg_type = <class 'int'>, arg_name = '`rank of x`', prim_name = 'in `Padding`'

    def check_number(arg_value, value, rel, arg_type=int, arg_name=None, prim_name=None):
        """
        Check argument integer.

        Usage:
        - number = check_int(number, 0, Rel.GE, "number", None) # number >= 0
        """
        rel_fn = Rel.get_fns(rel)
        type_mismatch = not isinstance(arg_value, arg_type) or isinstance(arg_value, bool)
        type_except = TypeError if type_mismatch else ValueError

        prim_name = f'in `{prim_name}`' if prim_name else ''
        arg_name = f'`{arg_name}`' if arg_name else ''
        if math.isinf(arg_value) or math.isnan(arg_value) or np.isinf(arg_value) or np.isnan(arg_value):
            raise ValueError(f'{arg_name} {prim_name} must be legal value, but got `{arg_value}`.')
        if type_mismatch or not rel_fn(arg_value, value):
            rel_str = Rel.get_strs(rel).format(value)
>           raise type_except(f'{arg_name} {prim_name} should be an {type(arg_type).__name__} and must {rel_str}, '
                              f'but got `{arg_value}` with type `{type(arg_value).__name__}`.')
E           ValueError: `rank of x` in `Padding` should be an type and must > 1, but got `1` with type `int`.

/root/archiconda3/envs/liwuxia_vm/lib/python3.7/site-packages/mindspore/_checkparam.py:112: ValueError

Describe the expected behavior

Show legitimate data types

Related log / screenshot

Special notes for this issue

Comments (2)

HidyLi createdBug-Report
HidyLi set deadline to 2020-12-31
HidyLi set related repository to MindSpore/mindspore
HidyLi set assignee to ZOMI酱
HidyLi set milestone to B-VM
HidyLi set start time to 2020-10-22
HidyLi set priority to Secondary
HidyLi added
 
kind/bug
label
HidyLi added device/ascend(deleted) label
HidyLi changed description
jjfeing changed title
lujiale changed assignee from ZOMI酱 to yuchaojie
lujiale assigned collaborator ZOMI酱
Expand operation logs
  1. 根因分析
    check_number错误显示的type信息不对

  2. 修改方法
    修改check_number错误显示,显示正确的数据type

yuchaojie changed issue state from TODO to VALIDATION
yuchaojie changed milestone from B-VM to B-ComponentTest
yuchaojie assigned collaborator yuchaojie
yuchaojie changed assignee from yuchaojie to HidyLi
HidyLi changed issue state from VALIDATION to DONE
HidyLi removed device/ascend(deleted) label

Sign in to comment

Status
Assignees
Projects
Milestones
Pull Requests
Successfully merging a pull request will close this issue.
Branches
Planed to start   -   Planed to end
-
Top level
Priority
Duration (hours)
参与者(3)
6557666 hidyli 1648689999 7386274 sanjaychan 1589292901
Python
1
https://gitee.com/mindspore/mindspore.git
git@gitee.com:mindspore/mindspore.git
mindspore
mindspore
mindspore

Search