我正尝试通过Java Tensorflow API启动Keras Tensorflow图形培训.
除了标准输入图像占位符之外,此图形还包含"keras_learning_phase"占位符,需要使用布尔值.
问题是,没有在任何方法TensorFlowInferenceInterface为布尔值-你只能给它浮动,双,INT或字节的值.
显然,当我尝试通过此代码将int传递给此张量时:
inferenceInterface.fillNodeInt("keras_learning_phase",
new int[]{1}, new int[]{0});
Run Code Online (Sandbox Code Playgroud)
我明白了
tensorflow_inference_jni.cc:207推理期间出错:内部:int32类型的输出0与声明的输出类型bool不匹配节点_recv_keras_learning_phase_0 = _Recvclient_terminated = true,recv_device ="/ job:localhost/replica:0/task:0/cpu:0 ",send_device ="/ job:localhost/replica:0/task:0/cpu:0",send_device_incarnation = 4742451733276497694,tensor_name ="keras_learning_phase",tensor_type = DT_BOOL,_device ="/ job:localhost/replica:0/task :0/CPU:0"
有没有办法规避它?
也许有可能以某种方式将图中的占位符节点显式转换为常量?
或者也许最初可以避免在图表中创建此占位符?