Tensorflow,从先前保存的Tensor中分配

时间:2018-11-20 19:24:25

标签: python tensorflow keras

我正在为先前构建的Keras模型构建一些实用程序操作。

我想将自己的操作将Tensor分配给Keras Model输入。

我的代码:

sess = K.get_session()

model = build_model()
output_node_names = [node.op.name for node in model.outputs]
inputs_nodes_names = [node.op.name for node in model.inputs]

print('Building the Utility Operations and Adding to Graph')
image, resized_image = normalize_tensor()
input_node = sess.graph.get_tensor_by_name(inputs_nodes_names[0] + ':0')
input_node = tf.assign(input_node, resized_image)

但是Tensorflow给我以下错误:

  

AttributeError:“ Tensor”对象没有属性“ assign”

我相信输入被视为不变张量,有什么想法可以解决这个问题吗?

谢谢!

0 个答案:

没有答案
相关问题