diff --git a/tf_adapter/kernels/geop_npu.cc b/tf_adapter/kernels/geop_npu.cc index c22896a8464866c7a4d3d60b80e1978301eb7160..8d01e762c4eb6656084e54b3b8f07dcac2385c61 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