未验证 提交 648f58aa 编写于 作者: W WangZhen 提交者: GitHub

Fix shape error when check no shape var type (#52629)

上级 45f660dd
......@@ -45,6 +45,7 @@ from .origin_info import (
from .partial_program import PartialProgramLayerHook, partial_program_from
from .utils import (
ALREADY_D2S,
NO_SHAPE_VAR_TYPE,
ast_to_func,
ast_to_source_code,
func_to_source_code,
......@@ -1217,7 +1218,7 @@ class ProgramCache:
if prim_or_cinn_is_enabled(cache_key.kwargs['build_strategy']):
for var in concrete_program.main_program.list_vars():
if -1 in var.shape:
if var.type not in NO_SHAPE_VAR_TYPE and -1 in var.shape:
warnings.warn(
"Now prim and cinn do not support -1 shape, but the shape of var {} is {}".format(
var.name, var.shape
......
......@@ -86,6 +86,13 @@ WHILE_BODY_PREFIX = 'while_body'
FOR_CONDITION_PREFIX = 'for_loop_condition'
FOR_BODY_PREFIX = 'for_loop_body'
NO_SHAPE_VAR_TYPE = [
core.VarDesc.VarType.READER,
core.VarDesc.VarType.STEP_SCOPES,
core.VarDesc.VarType.FEED_MINIBATCH,
core.VarDesc.VarType.FETCH_LIST,
]
class BaseNodeVisitor(gast.NodeVisitor):
"""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册