未验证 提交 9b0b155b 编写于 作者: W WangZhen 提交者: GitHub

Flatten input_spec when check neg shape (#50692)

* Flatten input_spec when check neg shape

* Fix cycle import
上级 7cc10b2e
...@@ -19,6 +19,7 @@ import threading ...@@ -19,6 +19,7 @@ import threading
import warnings import warnings
import weakref import weakref
import paddle
from paddle.fluid import _non_static_mode, core, framework from paddle.fluid import _non_static_mode, core, framework
from paddle.fluid.data_feeder import check_type from paddle.fluid.data_feeder import check_type
from paddle.fluid.dygraph import layers from paddle.fluid.dygraph import layers
...@@ -324,8 +325,11 @@ class StaticFunction: ...@@ -324,8 +325,11 @@ class StaticFunction:
if input_spec is not None and prim_or_cinn_is_enabled( if input_spec is not None and prim_or_cinn_is_enabled(
kwargs.get("build_strategy", None) kwargs.get("build_strategy", None)
): ):
for spec in input_spec: for spec in flatten(input_spec):
if spec is not None and -1 in spec.shape: if (
isinstance(spec, paddle.static.InputSpec)
and -1 in spec.shape
):
input_spec = None input_spec = None
warnings.warn( warnings.warn(
'Now prim and cinn do not support -1 shape, but input_spec has -1 shape so we set it to None.' 'Now prim and cinn do not support -1 shape, but input_spec has -1 shape so we set it to None.'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册