Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Machine learning Tensorflow弃用警告_Machine Learning_Tensorflow - Fatal编程技术网

Machine learning Tensorflow弃用警告

Machine learning Tensorflow弃用警告,machine-learning,tensorflow,Machine Learning,Tensorflow,我试图创建一个卷积神经网络图像分类使用开放存取github代码之一。我有两类图像。但是,当我开始运行代码的一部分时,我总是会遇到这个错误 /Users/user/anaconda/envs/tensorflow/lib/python3.5/site-packages/ipykernel/__main__.py:46: DeprecationWarning: elementwise == comparison failed; this will raise an error in the futu

我试图创建一个卷积神经网络图像分类使用开放存取github代码之一。我有两类图像。但是,当我开始运行代码的一部分时,我总是会遇到这个错误

/Users/user/anaconda/envs/tensorflow/lib/python3.5/site-packages/ipykernel/__main__.py:46: DeprecationWarning: elementwise == comparison failed; this will raise an error in the future.
这是代码中有错误的部分(虽然这个错误的根源可能在其他地方,但我的直觉告诉我,它存在于图像的标签中,但我不确定如何修复它,我尝试了多次重新标记,但没有任何效果来修复它)

def打印测试精度(显示示例错误=False,
显示\u混乱\u矩阵=错误):
#测试集中的图像数。
num\u test=len(测试图像)
#为预测的类分配一个数组
#将分批计算并填充到此数组中。
cls\u pred=np.zeros(shape=num\u test,dtype=np.int)
#现在计算批次的预测类。
#我们将迭代所有批次。
#也许有一种更聪明、更像蟒蛇的方法可以做到这一点。
#下一批的起始索引表示为i。
i=0
当i
试试:

或者,如果它是一个概率分布,而不仅仅是argmax:

correct = tf.equal(tf.argmax(cls_pred, 1), tf.argmax(cls_true, 1))

根据以上代码,此警告的唯一可能来源是
correct=(cls\u true==cls\u pred)
。请检查这两个阵列的大小是否相同您可能对我的文章感兴趣
correct = tf.equal(cls_pred, cls_true)
correct = tf.equal(tf.argmax(cls_pred, 1), tf.argmax(cls_true, 1))