From c0a656f0073f6ce8ed1e6c8ccca5d67715ef2c97 Mon Sep 17 00:00:00 2001 From: lianghuikang <505519763@qq.com> Date: Fri, 7 May 2021 14:19:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=88=86=E6=A1=A3=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E4=B8=8D=E6=A0=A1=E9=AA=8Cdynamic=5Finput?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tf_adapter/kernels/geop_npu.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tf_adapter/kernels/geop_npu.cc b/tf_adapter/kernels/geop_npu.cc index c22896a84..8d01e762c 100644 --- a/tf_adapter/kernels/geop_npu.cc +++ b/tf_adapter/kernels/geop_npu.cc @@ -481,12 +481,16 @@ void GeOp::ComputeAsync(OpKernelContext *ctx, DoneCallback done) { input_shapes.push_back(input_shape); cur_inputs_shape += input_shape; } - if (inputs_shape_.empty()) { - inputs_shape_ = cur_inputs_shape; - } else if ((inputs_shape_ != cur_inputs_shape) && ("1" != dynamic_input_)) { - OP_REQUIRES_ASYNC(ctx, false, errors::Internal("The input shape of ", ctx->op_kernel().name(), - " is dynamic, please set dynamic_input=True."), done); - return; + if (sess_options_["ge.inputShape"].empty() && + sess_options_["ge.dynamicDims"].empty() && + sess_options_["ge.dynamicNodeType"].empty()) { + if (inputs_shape_.empty()) { + inputs_shape_ = cur_inputs_shape; + } else if ((inputs_shape_ != cur_inputs_shape) && (dynamic_input_ != "1")) { + OP_REQUIRES_ASYNC(ctx, false, errors::Internal("The input shape of ", ctx->op_kernel().name(), + " is dynamic, please set dynamic_input=True."), done); + return; + } } // if input shapes changed, cache graphs -- Gitee