您现在的位置是:主页 > news > 网站支持ipv6做哪些改造/百度推广开户公司
网站支持ipv6做哪些改造/百度推广开户公司
admin2025/6/27 9:29:59【news】
简介网站支持ipv6做哪些改造,百度推广开户公司,旅游网站怎么做才能被关注,创建wordpress博客我想为我的C库创建一个Python包装器。如果能够自动将std::vector转换为python列表,或者反过来,那就太酷了。不幸的是,如果我把这些代码添加到接口文件中,在运行时仍然会出现错误。在%typemap(in) std::vector value (s…
我想为我的C++库创建一个Python包装器。如果能够自动将std::vector转换为python列表,或者反过来,那就太酷了。
不幸的是,如果我把这些代码添加到接口文件中,在运行时仍然会出现错误。在%typemap(in) std::vector value (std::vector vIn) {
int iLen = PySequence_Length($input);
for(unsigned int i = 0; i < iLen; i++) {
PyObject *o = PySequence_GetItem($input, i);
if (PyNumber_Check(o)) {
vIn.push_back((float)PyFloat_AsDouble(o) );
}
}
$1 = vIn;
}
%typemap(out) std::vector {
std::vector vOut = $1;
int iLen = vOut.size();
$result = PyList_New(iLen);
for(unsigned int i = 0; i < iLen; i++) {
double fVal = vOut.at(i);
PyObject *o = PyFloat_FromDouble((double) fVal);
PyList_SetItem($result, i, o);
}
}
类标题:
^{pr2}$
Python代码:trainSet = TrainingSet()
trainSet.AddInput([0.5, 0.5, 0.5])
错误:File "runSOMNet.py", line 9, in
trainSet.AddInput([0.5, 0.5, 0.5])
File "/home/dgrat/annetgpgpu/build/ANNet/ANPyNetCPU.py", line 674, in AddInput
def AddInput(self, *args): return _ANPyNetCPU.TrainingSet_AddInput(self, *args)
NotImplementedError: Wrong number or type of arguments for overloaded function 'TrainingSet_AddInput'.
Possible C/C++ prototypes are:
ANN::TrainingSet::AddInput(std::vector< float,std::allocator< float > > const &)
ANN::TrainingSet::AddInput(float *,unsigned int const &)