定义了一个Metric函数:
def Custom_Metric(y_true, y_pred):
k = tf.cond(y_pred[0] < p0 and y_pred[1] <= p1 and y_pred[2] >= p2 and (y_pred[1] + y_pred[2]) >= p3 and (y_true[1]+y_true[2]) > 0, lambda: 1, lambda: 0)
j = tf.cond(y_pred[0] < p0 and y_pred[1] <= p1 and y_pred[2] >= p2 and (y_pred[1] + y_pred[2]) >= p3, lambda: 1, lambda: 0)
rate = tf.cond(j == 0, lambda: float(0), lambda: float(round(k / j * 100, 2)))
return rate
然后报错:
tensorflow.python.framework.errors_impl.InvalidArgumentError: The second input must be a scalar, but it has shape [3]
[[{{node cond/IteratorGetNext/_6}}]] [Op:__inference_train_function_3637]
Function call stack:
train_function
return rate 的数据类型是Tensor("cond_4/Identity:0", shape=(), dtype=float32)
请问各位大神要怎么办呀?
爆粗提示你的属性设置不完整啊
现在做到哪一步了