已关闭
[CT][MS][OPS][ops.prelu][function][全量]prelu 部分用例GE流程新增报错For 'PReLU', the dimension of 'x' can not be 0-D or 1-D when the platform is "Ascend" #514
tanxinglian创建于  2024年11月29日关闭于  2024年12月10日
tanxinglian
2024年11月29日 创建

1.Describe the current behavior / 问题描述 (Mandatory / 必填)

样例: (根据实际修改和增删)

prelu 部分用例GE流程新增报错For 'PReLU', the dimension of 'x' can not be 0-D or 1-D when the platform is "Ascend"

2.Environment / 环境信息 (Mandatory / 必填)

  • Hardware Environment / 硬件环境(Mandatory / 必填):
    Hardware (e.g.Ascend910B1/Mac CPU)

    样例:

后端类型 硬件具体类别
Ascend 910A
  • Software Environment / 软件环境 (Mandatory / 必填):
    迭代版本新增问题样例:(根据实际修改和增删)

    bugfix版本问题引入样例:(根据实际修改和增删)

Software Version(根据实际修改,必填)
MindSpore 1118包mindspore_commit=commit_id = '[sha1]:ba3b20b1,[branch]:(HEAD,origin/master,origin/HEAD,master)' (失败)1027包mindspore_commit=commit_id = '[sha1]:8c86f33f,[branch]:(HEAD,origin/master,origin/HEAD,master)'(成功)
CANN Milan_C19/20241026(成功) Milan_C19/20241026(失败)
Python Python 3.10.2
OS platform eulerosv2r10
GCC/Compiler version 7.3

3.Related testcase / 关联用例 (Mandatory / 必填)

  • Testcase Name/ 用例名 (Mandatory / 必填):
    -- Testcase Name(e.g.test_mf_llama_7b_wiki4096_train_cell_dp1mp4pp4mb4_910_16p_0005):
    test_dynamic_shape_p_prelu_3d_float16
    test_dynamic_shape_p_prelu_3d_float32
    test_f_prelu_softplus_float32_empty_tensor
  • Excute Mode / 执行模式 (Mandatory / 必填):
    -- Excute Mode(e.g., Graph\PyNative): Graph
    -- Excute Mode(e.g., O0\O1\O2):910B:O2 910A不设置

4.Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)

(1)export CONTEXT_DEVICE_TARGET=Ascend
export CONTEXT_MODE=GRAPH_MODE
(2)cd MindSporeTest/operations
(3)pytest -s -v test_prelu.py::test_dynamic_shape_p_prelu_3d_float16
pytest -s -v test_prelu.py::test_dynamic_shape_p_prelu_3d_float32
pytest -s -v test_f_prelu.py::test_f_prelu_softplus_float32_empty_tensor

5.Describe the expected behavior / 预期结果 (Mandatory / 必填)

【预期结果】:用例执行通过

6.Related log / screenshot / 日志 / 截图 (Mandatory / 必填)

报错关键日志截图:

@Level2
    @SKIP_ENV_CPU()
    def test_dynamic_shape_p_prelu_3d_float16():
        input_np = np.random.randn(8, 8, 8, 8).astype(np.float16)
        w_np = np.random.randn(8, 8, 8).astype(np.float16)
        indices_x_np = np.unique(np.random.randint(0, high=2, size=(2,)).astype(np.int32))
        indices_w_np = np.random.choice(3, size=(2,), replace=False).astype(np.int32)
        fact = PReLUDynamicShapeMock(input_np, w_np, indices_x_np, indices_w_np, dtype=np.float16)
>       fact.forward_cmp()

../test_prelu.py:356: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../dynamic_shape_operations/prelu.py:62: in forward_cmp
    out_ms = self.forward_mindspore_impl()
../../dynamic_shape_operations/prelu.py:45: in forward_mindspore_impl
    out_ms = ms_net(input_ms, w_ms, indices_x_ms, indices_w_ms)
/home/miniconda3/envs/ci_310/lib/python3.10/site-packages/mindspore/nn/cell.py:720: in __call__
    out = self.compile_and_run(*args, **kwargs)
/home/miniconda3/envs/ci_310/lib/python3.10/site-packages/mindspore/nn/cell.py:1138: in compile_and_run
    self.compile(*args, **kwargs)
/home/miniconda3/envs/ci_310/lib/python3.10/site-packages/mindspore/nn/cell.py:1121: in compile
    _cell_graph_executor.compile(self, *self._compile_args, phase=self.phase,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <mindspore.common.api._CellGraphExecutor object at 0xfffe96d5c760>
obj = DynamicShapePReLU<>, phase = 'train.1732502596068560384.281467697774432.0'
do_convert = True
jit_config_dict = {'debug_level': 'RELEASE', 'exc_mode': 'auto', 'infer_boost': 'off', 'jit_level': '', ...}
args = (Tensor(shape=[-1, -1, -1, -1], dtype=Float16, value=
), Tensor(shape=[-1, -1, -1], dtype=Float16, value=
), Tensor(shape=[-1], dtype=Int32, value= ), Tensor(shape=[-1], dtype=Int32, value= ))
kwargs = {}, key_id = '2814676977744321732502596068560384', key = 0
parameter_ids = '', raw_phase = 'train'
full_function_name = 'DynamicShapePReLU.1.187651897990448'
echo_function_name = 'DynamicShapePReLU'

    def compile(self, obj, *args, phase='predict', do_convert=True, jit_config_dict=None, **kwargs):
        """
        Compiles graph.
    
        Args:
            obj (Function/Cell): The function or cell instance need compile.
            phase (str): The name of compile phase. Default: 'predict'.
            do_convert (bool): When set to True, convert ME graph to GE graph after compiling graph.
            jit_config_dict (dict): Jit config for compile. Default: ``None``.
            args (tuple): Args of the Cell object.
            kwargs (dict): Kwargs of the Cell object.
    
        Return:
            Str, the full phase of the cell.
            Bool, if the graph has been compiled before, return False, else return True.
        """
        obj.__parse_method__ = 'construct'
        if not hasattr(obj, obj.__parse_method__):
            raise AttributeError(
                'The class {} dose not have method {}'.format(obj.__class__.__name__, obj.__parse_method__))
        key_id = str(id(obj)) + str(obj.create_time)
        args = get_auto_dynamic_shape_args(args, key_id)
    
        self.enable_tuple_broaden = False
        if hasattr(obj, "enable_tuple_broaden"):
            self.enable_tuple_broaden = obj.enable_tuple_broaden
        logger.debug(f"Convert the network: {do_convert}.")
        self._graph_executor.set_enable_tuple_broaden(self.enable_tuple_broaden)
        key = self._graph_executor.generate_arguments_key(obj, args, kwargs, self.enable_tuple_broaden)
        obj.arguments_key = str(key)
        # When exist parameter in the top graph inputs, need check if the parameter object has changed.
        parameter_ids = _get_parameter_ids(args, kwargs)
        if parameter_ids != "":
            obj.arguments_key = obj.arguments_key + '.' + parameter_ids
        raw_phase = phase
        phase = phase + '.' + str(obj.create_time) + '.' + str(id(obj)) + '.' + obj.arguments_key
        obj.phase_cache[raw_phase] = phase
        update_auto_dynamic_shape_phase(args, key_id, phase)
        obj.current_phase = phase
        if phase in obj.compile_cache and self.has_compiled(phase):
            logger.debug("%r graph has existed.", phase)
            # Release resource should be released when CompileInner won't be executed, such as cur_convert_input_
            # generated in generate_arguments_key.
            self._graph_executor.clear_compile_arguments_resource()
            return phase, False
    
        full_function_name = obj.__class__.__name__ + '.' + str(obj.instance_count) + '.' + str(id(type(obj)))
        echo_function_name = obj.__class__.__name__
        _check_recompile(obj, args, kwargs, full_function_name, obj.create_time, echo_function_name)
    
        obj.check_names()
        _check_full_batch()
        self._set_dataset_mode(obj)
        self._set_compile_cache_dep_files(phase)
    
        self._graph_executor.set_weights_values(obj.parameters_dict())
        if jit_config_dict:
            self._graph_executor.set_jit_config(jit_config_dict)
        else:
            jit_config_dict = JitConfig().jit_config_dict
            self._graph_executor.set_jit_config(jit_config_dict)
>       result = self._graph_executor.compile(obj, args, kwargs, phase, self._use_vm_mode())
E       ValueError: For 'PReLU', the dimension of 'x' can not be 0-D or 1-D when the platform is "Ascend", but got dimension of 'x' is 1.
E       
E       ----------------------------------------------------
E       - C++ Call Stack: (For framework developers)
E       ----------------------------------------------------
E       mindspore/ops/infer/ops_func_impl/prelu.cc:71 CheckValidation
E       
E       ----------------------------------------------------
E       - The Traceback of Net Construct Code:
E       ----------------------------------------------------
E       # 0 In file /home/jenkins-slave/workspace/mindspore_ascend_opensource/MindSporeTest/dynamic_shape_operations/prelu.py:23, 15~31
E               return self.prelu(x, w)
E                      ^~~~~~~~~~~~~~~~
E        (See file '/home/jenkins-slave/workspace/mindspore_ascend_opensource/MindSporeTest/operations/cida_test_dynamic_shape_p_prelu_3d_float16/rank_0/om/analyze_fail.ir' for more details. Get instructions about `analyze_fail.ir` at https://www.mindspore.cn/search?inputValue=analyze_fail.ir)

/home/miniconda3/envs/ci_310/lib/python3.10/site-packages/mindspore/common/api.py:1840: ValueError

完整日志(通过附件上传):

https://testreporter.szv.dragon.tools.huawei.com/TestDataBot/analysis/taskdetailes?productId=mindspore&productLine=2012 Laboratories&taskId=2061129104884236288&tmssPath=/03200tqk2t5d0/03100vvnngnc8/030e0vvo1a8pp/&title=CT_mindspore_ascend910a_op_graph_standalone_full_reRun4122_2024-11-25 11%3A40%3A09&isMergedTask=false&nodeDate=2024-11-25&year=2023-2024&TestNow=true&testcaseid=6730dc86010e0252f297a973&workspaceId=6743ed87b02aec492064b33d

https://testreporter.szv.dragon.tools.huawei.com/TestDataBot/analysis/taskdetailes?productId=mindspore&productLine=2012 Laboratories&taskId=2061129104884236288&tmssPath=/03200tqk2t5d0/03100vvnngnc8/030e0vvo1a8pp/&title=CT_mindspore_ascend910a_op_graph_standalone_full_reRun4122_2024-11-25 11%3A40%3A09&isMergedTask=false&nodeDate=2024-11-25&year=2023-2024&TestNow=true&testcaseid=6730dc7e010e0252f297a79e&workspaceId=6743ed87b02aec492064b33d

https://testreporter.szv.dragon.tools.huawei.com/TestDataBot/analysis/taskdetailes?productId=mindspore&productLine=2012 Laboratories&taskId=2061129104884236288&tmssPath=/03200tqk2t5d0/03100vvnngnc8/030e0vvo1a8pp/&title=CT_mindspore_ascend910a_op_graph_standalone_full_reRun4122_2024-11-25 11%3A40%3A09&isMergedTask=false&nodeDate=2024-11-25&year=2023-2024&TestNow=true&testcaseid=67314b35c288a4670e72aa0e&workspaceId=6743ed87b02aec492064b33d

7.Special notes for this issue/备注 (Optional / 选填)

【定位人】

likedislike
Ttanxinglian
2024年11月29日 添加了关联分支的 master 选项
Ttanxinglian
2024年11月29日 添加了问题后端类型的 Ascend 选项
Ttanxinglian
2024年11月29日 创建了Bug-Report
tanxinglian
2024年12月2日 评论:

相同用例2.4.1分支上也有同样问题

likedislike
Ttanxinglian
2024年12月2日 添加了关联分支的 r2.4.1 选项
此处折叠了8条事件消息 查看更多
AAtomGit-Bot
2024年12月5日 将任务状态从 TODO 修改为VALIDATION
tanxinglian
2024年12月10日 评论:

2.4.1
【回归版本号】:commit_id = '[sha1]:c783eb41,[branch]:(HEAD,origin/r2.4.1,r2.4.1)'
【回归环境信息】:Ascend,euleros , arm
【测试日志】:
输入图片说明
输入图片说明

master
【回归版本号】:commit_id = '[sha1]:6dcdc8c0,[branch]:(HEAD,origin/master,origin/br_ops,origin/HEAD,master)'
【回归环境信息】:Ascend,euleros , arm
【测试日志】:
输入图片说明
输入图片说明

likedislike
AAtomGit-Bot
2024年12月10日 添加了 &nbsp; kind/bug 标签
此处折叠了8条事件消息 查看更多
AtomGit小助手AtomGit小助手成员
2025年12月13日 关联了看板:MindSpore Bug Tracking System