我有个错误:ValueError: Tensor conversion requested dtype float64 for Tensor with dtype float32: 'Tensor("pearson_r/covariance/Cast:0", shape=(), dtype=float32)'
我的代码如下:
^{pr2}$
完整的错误消息是:---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in
274 #testLabels = tf.convert_to_tensor(array(testLabels), dtype=tf.float64)
275
--> 276 corr=correlation_coefficient(ynew, array(testLabels))
277 print('Test Correlation: %f' % (cor*100))
278
in correlation_coefficient(y_true, y_pred)
45
46 def correlation_coefficient(y_true, y_pred):
---> 47 return tf.contrib.metrics.streaming_pearson_correlation(y_pred, y_true)[1]
48
49
/opt/conda/lib/python3.6/site-packages/tensorflow/contrib/