I want to train a model for which the loss function can only be computed externally. So, I take the output of my last layer, compute some value externally and want to use this to update my network. Can I implement such a setup in tensorflow?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Yes you can, you have to define your minimised loss out of the graph, for example:
loss = Network.loss(input_tensor)
loss_2 = out_function(loss)
And then you just have to specify :
train_step = optimizer.minimize(loss_2)
It should work