更新时间:2023-12-03 10:56:04
否,执行梯度下降需要使用梯度,因此,与只有符号损失的数字损失相比,如果您只有数值损失,则无法进行微分.通过Keras.
No, gradients are needed to perform gradient descent, so if you only have a numerical loss, it cannot be differentiated, in contrast to a symbolic loss that is required by Keras.
您唯一的机会是使用keras.backend
函数来实现损失,或者使用另一个可以让您手动指定梯度的深度学习框架.您仍然需要以某种方式计算梯度.
Your only chance is to implement your loss using keras.backend
functions or to use another Deep Learning framework that might let you specify the gradient manually. You still would need to compute the gradient somehow.