tensorlfow gradient.tape可以与占位符一起使用吗?

时间:2020-03-10 01:30:29

标签: python tensorflow

我想计算与损耗和输入对应的梯度。但是我想在数据集中批量运行它,然后递归执行。

test_inputs = tf.placeholder(shape=[1, 256, 256,3], dtype=tf.float32)

with tf.GradientTape() as tape:
    tape.watch(test_inputs)
    test_outputs = generator(test_inputs, layers=4, output_channel=3)
    test_error = loss(gen_frames=test_outputs, gt_frames=test_gt)
gradient = tape.gradient(test_error, test_inputs)

它与sess和feed_dict一起运行

loss = sess.run((test_error), feed_dict={test_inputs: images})

有什么方法可以使渐变色带与占位符一起使用?

0 个答案:

没有答案
相关问题