@[求助](正则化losses报错Failed to convert object of type <type ‘function’> to Tensor)
Failed to convert object of type <type ‘function’> to Tensor. Contents: <function l2 at 0x7fcd9f9cdcd0>. Consider casting elements to a supported type.
在对损失函数加入正则化部分时,程序报错,无法把tf.add_n(tf.get_collection(‘losses’))赋值给变量。
loss_mse = tf.reduce_mean(tf.square(y-y_))
loss_total = loss_mse + tf.add_n(tf.get_collection(‘losses’))
第二句报错Failed to convert object of type <type ‘function’> to Tensor. Contents: <function l2 at 0x7fcd9f9cdcd0>. Consider casting elements to a supported type.