Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Machine learning 在tensorflow元图中重置输入占位符的形状_Machine Learning_Tensorflow_Neural Network_Deep Learning_Conv Neural Network - Fatal编程技术网

Machine learning 在tensorflow元图中重置输入占位符的形状

Machine learning 在tensorflow元图中重置输入占位符的形状,machine-learning,tensorflow,neural-network,deep-learning,conv-neural-network,Machine Learning,Tensorflow,Neural Network,Deep Learning,Conv Neural Network,我用tensorflow训练了一个神经网络。在培训时,我明确定义了批量大小为20的输入占位符的形状,如下所示[20224224,3]。我明确地定义了批量大小,因为e是网络中的一个split层,将None作为批量大小传递会在该层上抛出错误。是否有任何方法可以在推断时更改输入占位符的形状,以便在单个图像上进行推断?如果保存了检查点的*.meta文件,则可以将输入重置为图形 # Set the correct data type and shape; shape can be (None, 224,

我用tensorflow训练了一个神经网络。在培训时,我明确定义了批量大小为20的输入占位符的形状,如下所示
[20224224,3]
。我明确地定义了批量大小,因为e是网络中的一个
split
层,将
None
作为批量大小传递会在该层上抛出错误。是否有任何方法可以在推断时更改输入占位符的形状,以便在单个图像上进行推断?

如果保存了检查点的*.meta文件,则可以将输入重置为图形

# Set the correct data type and shape; shape can be (None, 224, 224, 3) also
new_placeholder = tf.placeholder(tf.float32, shape=(1, 224, 224, 3), name='inputs_new_name') 
# here you need to state the name of the placeholder you used in your original input placeholder  

saver = tf.import_graph_def(path/to/.meta, input_map={"original_inputs_placeholder_name:0": new_placeholder})
saver.restore(/path/to/your_checkpoint)

执行此操作时会出现形状不匹配错误:形状不兼容