Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/297.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
Python numpy.float64';对象不可编辑--TypeError_Python_Tensorflow_Keras - Fatal编程技术网

Python numpy.float64';对象不可编辑--TypeError

Python numpy.float64';对象不可编辑--TypeError,python,tensorflow,keras,Python,Tensorflow,Keras,我不明白为什么会发生这个错误!!更改此错误的更好解决方案是什么??谁能解释一下为什么会这样 the error is as follows: Train... (0, 0) start 2020-04-11 13:55:01.049361: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled

我不明白为什么会发生这个错误!!更改此错误的更好解决方案是什么??谁能解释一下为什么会这样

the error is as follows: 
Train...
(0, 0)
start
2020-04-11 13:55:01.049361: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Test1...
integeroverflow_1_.pkl
api_1_.pkl
pointersuse_5_.pkl
pointersuse_4_.pkl
pointersuse_3_.pkl
pointersuse_0_.pkl
arraysuse_1_.pkl
integeroverflow_0_.pkl
api_3_.pkl
pointersuse_2_.pkl
arraysuse_0_.pkl
api_2_.pkl
api_0_.pkl
pointersuse_1_.pkl
(8492, 8492, 8492)
Traceback (most recent call last):
  File "bgru.py", line 220, in <module>
    main(traindataSetPath, testdataSetPath, realtestdataSetPath, weightPath, resultPath, batchSize, maxLen, vectorDim, layers, dropout)
  File "bgru.py", line 126, in main
    score, TP, FP, FN, precision, recall, f_score= result[0]
TypeError: 'numpy.float64' object is not iterable
完整的代码在


我已经上传了我正在运行的完整代码。请查看

您正在尝试解包一个numpy float。尝试此操作,您将得到相同的错误:

v1, v2 = np.float64(1.3)  # numpy.float64 object, cannot be unpacked because it is not an iterable 
结果[0]是一个numpy浮点,与np.float64一样。
我不确定
results
包含什么,但是如果您想要的数据在数组
result

中,那么删除
[0]
索引可能会解决您的问题。尝试此操作,您将得到相同的错误:

v1, v2 = np.float64(1.3)  # numpy.float64 object, cannot be unpacked because it is not an iterable 
结果[0]是一个numpy浮点,与np.float64一样。
我不确定
结果
包含哪些内容,但是删除
[0]
索引可能会解决您的问题,如果您需要的数据位于数组
结果

为您的模型定义了哪些指标?似乎只定义了损失,所以evaluate_生成器只返回一个number@MatiasValdenegrometrics=['accurity','mae']可能会包含再现问题的完整代码。@MatiasValdenegro我刚刚编辑了我的文章,所以您可以使用该链接查看完整代码这似乎不是您的代码(指标不同),如果您修改了该代码,那么任何更改都可以解释问题:为您的模型定义了哪些度量?似乎只定义了损失,所以evaluate_生成器只返回一个number@MatiasValdenegrometrics=['accurity','mae']可能会包含再现问题的完整代码。@MatiasValdenegro我刚刚编辑了我的文章,所以您可以使用该链接查看完整代码这似乎不是您的代码(指标不同),如果您修改了该代码,那么任何更改都可以解释问题
v1, v2 = np.float64(1.3)  # numpy.float64 object, cannot be unpacked because it is not an iterable