[英]“TypeError: Unknown parameter type: <class 'dict_values'>”
I am using this code: " https://github.com/LouisFoucard/MC_DCNN/blob/master/.ipynb_checkpoints/MultiChannel_DeepConvNet-checkpoint.ipynb " 我正在使用此代码:“ https://github.com/LouisFoucard/MC_DCNN/blob/master/.ipynb_checkpoints/MultiChannel_DeepConvNet-checkpoint.ipynb ”
When I run the code, I get the error that: 运行代码时,出现以下错误:
TypeError: unsupported operand type(s) for +: 'dict_values' and 'list' TypeError:+不支持的操作数类型:“ dict_values”和“ list”
This error is related to this line of the code: 此错误与此代码行有关:
train = theano.function(inps.values()+[target_values],cost, updates=updates)
I changed this line to: 我将此行更改为:
train = theano.function(inputs=[inps.values(), target_values], outputs=cost, updates=updates)
This time I get the error that: 这次我得到的错误是:
TypeError: Unknown parameter type: TypeError:未知参数类型:
This seems that Theano.function does not accept Dictionary.values as inputs? 似乎Theano.function不接受Dictionary.values作为输入?
Thanks 谢谢
It seems you are trying to run some python 2 code in python 3, where dict.values
returns a dictionary view object 看来您正在尝试在python 3中运行一些python 2代码,其中dict.values
返回一个字典视图对象
The solution is quite simple - just wrap your dict.values
in a list
: 解决方案非常简单-只需将dict.values
包装在list
:
train = theano.function(list(inps.values())+[target_values], cost, updates=updates)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.