Tensorflow 2中的外部推理上下文(shape_refiner.cc)是什么?

问题描述 投票:2回答:1

这是Tensorflow的github页面上的shape_refiner.cc

// TODO(b/134547156): TEMPORARY WORKAROUND. If input shape handle is not set
// in outer context, set _Arg node output shape to unknown.
if (outer_context->input(index).SameHandle(ShapeHandle())) {
  LOG(WARNING) << "Function instantiation has undefined input shape at "
               << "index: " << index << " in the outer inference context.";
  node_context->set_output(0, node_context->UnknownShape());
} else {
  node_context->set_output(0, outer_context->input(index));
}

auto* resource = outer_context->input_handle_shapes_and_types(index);
if (resource) {
  node_context->set_output_handle_shapes_and_types(0, *resource);
}

我一直在上面的代码中设置警告,这对我来说毫无意义。我应该更改代码还是对培训过程无害?该问题与我的其他问题链接:How to combine a pre-trained KerasLayer from TensorFlow (v. 2) Hub and tfrecords?

c# python c++ tensorflow tensorflow2.0
1个回答
0
投票

我刚刚遇到了同样的问题。就我而言,此警告是由于我滥用'@ tf.function'注释引起的。我尝试在非动态tf.keras模型调用方法中使用此注释。

© www.soinside.com 2019 - 2024. All rights reserved.