您的位置:首页 > 运维架构

TypeError: loop of ufunc does not support argument 0 of type Tensor which has no callable sqrt met

2020-06-06 07:42 2687 查看

使用tensorflow时出现的一错误

  • 利用CNN预测时,计算均方根误差报错如下:
cross_entropy = np.sqrt(tf.reduce_mean(tf.reduce_sum(tf.square(ys - prediction), reduction_indices=[1])))

错误如下:
TypeError: loop of ufunc does not support argument 0 of type Tensor which has no callable sqrt met
原因应该是numpy要求输入的是矩阵,输入类型不对,改为:

cross_entropy = tf.sqrt(tf.reduce_mean(tf.reduce_sum(tf.square(ys - prediction), reduction_indices=[1])))

就可以了

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐