随着 Keras2 即将在 TensorFlow 和 TensorFlow 2.0 中实现,您应该将 KerasImageDataGenerator 与 eg 一起使用,flow_from_directory还是现在tf.data也可以与fit_genearatorKeras一起使用的 TensorFlow ?
这两种方法是否会因服务于不同的目的而占有一席之地,还是会tf.data成为未来的新方法而 Keras 生成器将被弃用?
谢谢,我想走这条路,让我在这个快速发展的领域保持更长时间的了解。
我在自定义损失函数中有一些TensorFlow代码。
我正在使用 tf.Print(node, [debug1, debug2], "print my debugs: ")
它工作正常,但TF说tf.Print是被描述的,一旦我更新TensorFlow并且我应该使用`` tf.**p**rint()p'' 小将被删除。
我尝试使用tf.print与我相同的方式,tf.Print()但无法正常工作。一旦我在Keras中安装了模型,就会出现错误。不像tf.Print,tf.print似乎可以吸收任何东西**kwargs,那么我应该给它什么呢?与tf.Print它不同的是,似乎没有返回我可以注入到计算图中的内容。
确实很难搜索,因为所有在线信息都与有关tf.Print()。
有人可以解释如何使用tf.print()吗?
编辑:示例代码
def custom_loss(y_true, y_pred):
loss = K.mean(...)
print_no_op = tf.Print(loss, [loss, y_true, y_true.shape], "Debug output: ")
return print_no_op
model.compile(loss=custom_loss)
Run Code Online (Sandbox Code Playgroud)