完整错误
ValueError: Output tensors to a Model must be the output of a TensorFlow `Layer` (thus holding past layer metadata). Found: Tensor("my_loss_18/add:0", shape=(?, 1), dtype=float32)
解决办法:第一种方法,使用Lambda定义层包裹函数。第二种方法,包裹函数的参数必须是层的输出
完整错误
ValueError: Output tensors to a Model must be the output of a TensorFlow `Layer` (thus holding past layer metadata). Found: Tensor("my_loss_18/add:0", shape=(?, 1), dtype=float32)
解决办法:第一种方法,使用Lambda定义层包裹函数。第二种方法,包裹函数的参数必须是层的输出