什么是keras张量流代码中的K.eval(损失)

时间:2017-09-09 04:24:40

标签: python tensorflow keras

在这个keras / tensorflow代码中:

h = input ("Enter the initial height of the ball:"); h = int(h)
v = input ("Enter the initial velocity of the ball:"); v = int (v)
t = input ("Enter the time of the ball"); t = int(t)

maxH = h + (-(v ** 2 )) / ( 2 * (-16))

ballT = (h + (v*t) - (16*t*t))

print("The maximum height of the ball is", maxH, "feet.")
print("After",t,"seconds the ball will be at a height of",ballT,"feet.")

import keras.backend as K y_pred = model.predict(X) loss = keras.losses.categorical_crossentropy( K.variable(y_true), K.variable(y_pred)) print("K.eval(loss):", K.eval(loss)) 给你的是什么?我在哪里可以看到这个?

1 个答案:

答案 0 :(得分:3)

K.eval评估变量的值。因此,K.eval(loss)会为您提供交叉熵损失的值。