问题描述
限时送ChatGPT账号..我正在使用此代码:"https://github/LouisFoucard/MC_DCNN/blob/master/.ipynb_checkpoints/MultiChannel_DeepConvNet-checkpoint.ipynb"
I am using this code: "https://github/LouisFoucard/MC_DCNN/blob/master/.ipynb_checkpoints/MultiChannel_DeepConvNet-checkpoint.ipynb"
当我运行代码时,出现以下错误:
When I run the code, I get the error that:
TypeError: 不支持 + 的操作数类型:'dict_values' 和 'list'
TypeError: unsupported operand type(s) for +: 'dict_values' and 'list'
这个错误与这行代码有关:
This error is related to this line of the code:
train = theano.function(inps.values()+[target_values],cost, updates=updates)
我将此行更改为:
train = theano.function(inputs=[inps.values(), target_values], outputs=cost, updates=updates)
这次我得到的错误是:
类型错误:未知参数类型:
TypeError: Unknown parameter type:
这似乎是 Theano.function 不接受 Dictionary.values 作为输入?
This seems that Theano.function does not accept Dictionary.values as inputs?
谢谢
推荐答案
看来您正在尝试在 python 3 中运行一些 python 2 代码,其中 dict.values
返回一个 字典视图对象
It seems you are trying to run some python 2 code in python 3,
where dict.values
returns a dictionary view object
解决方案非常简单 - 只需将您的 dict.values
包装在 list
中:
The solution is quite simple - just wrap your dict.values
in a list
:
train = theano.function(list(inps.values())+[target_values], cost, updates=updates)
这篇关于"TypeError: 未知参数类型:<class 'dict_values'>>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论