2020
10-08
10-08
keras 自定义loss层+接受输入实例
loss函数如何接受输入值keras封装的比较厉害,官网给的例子写的云里雾里,在stackoverflow找到了答案Youcanwrapthelossfunctionasainnerfunctionandpassyourinputtensortoit(ascommonlydonewhenpassingadditionalargumentstothelossfunction).defcustom_loss_wrapper(input_tensor):defcustom_loss(y_true,y_pred):returnK.binary_crossentropy(y_true,y_pred)+K.mean(input_tensor)return...
继续阅读 >