通行列表需要std :: prinitizer_list< std :: prinitizer_list<类型> >
我现在使用OpenNN来写概念验证,并且我对张量的输入有问题。
来自Opennn negets 我们看到神经网络
Tensor<type, 2> inputs(1,9);
inputs.setValues({{type(4),type(3),type(3),type(2),type(3),type(4),type(3),type(2),type(1)}});
neural_network.calculate_outputs(inputs);
我确实 接受了张量的输入,将矢量转换为张量的解决方法,但它很长,有点乏味。
然后,我试图通过向量的向量,一个括号封闭的向量,一个括号封闭的数组,一个动态分配值列表的数组。
错误:
cannot convert '<brace-enclosed initializer list>' to 'const Eigen::internal::Initializer<Eigen::Tensor<long long unsigned int, 2>, 2>::InitList&' {aka 'const std::initializer_list<std::initializer_list<long long unsigned int> >&'}
错误继续只是一个变体(类型不匹配类型) 重现错误的代码(假设您已经获得了OpenNN库设置。
Tensor<uint64_t, 2> createFilledTensor(int index)
{
uint64_t * inList = new uint64_t[index]();
for(int i = 0; i < index; i++)
{
inList[i] = 356534563546356;
}
Tensor<uint64_t, 2> inputs(1, index);
inputs.setValues({inList});
return inputs;
}
此外,值得注意的是,现在数据无关紧要,因为我试图弄清楚如何将其获取张量。
I'm using OpenNN to write a proof of concept right now, and I'm having an issue with declaring inputs for a Tensor.
From the OpenNN website we see that the neural net accepts a Tensor input
Tensor<type, 2> inputs(1,9);
inputs.setValues({{type(4),type(3),type(3),type(2),type(3),type(4),type(3),type(2),type(1)}});
neural_network.calculate_outputs(inputs);
I did figure out a workaround to convert a vector to a tensor, but it's long and a little tedious.
I then attempted to pass a vector of a vector, a brace enclosed vector, a brace enclosed array, a dynamically allocated array of the list of values.
The error:
cannot convert '<brace-enclosed initializer list>' to 'const Eigen::internal::Initializer<Eigen::Tensor<long long unsigned int, 2>, 2>::InitList&' {aka 'const std::initializer_list<std::initializer_list<long long unsigned int> >&'}
The error continues to just be a variation of (Type does not match type)
The code to reproduce the error (assuming you've gotten the OpenNN library setup.
Tensor<uint64_t, 2> createFilledTensor(int index)
{
uint64_t * inList = new uint64_t[index]();
for(int i = 0; i < index; i++)
{
inList[i] = 356534563546356;
}
Tensor<uint64_t, 2> inputs(1, index);
inputs.setValues({inList});
return inputs;
}
Also, feel it's worth noting, right now the data doesn't matter as I am trying to figure out HOW to get it to the tensor.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑:
找到相关帖子在这里
解决方案更适合其他任何人,我的问题无法回答。
我解决了此问题如下:
PAIR(VEC是数据列表,INT是正在处理的数据量。我这样做是为了个人用途,因为它具有特殊的应用程序,但我相信您可以使用vec.size(),只需要向量作为param
EDIT:
Found a relevant post here
This solution is more for anyone else that comes around and my question can't be answered;
I solved this problem as follows:
where pair(vec is the data list, and int is the amount of data being processed. I did this for my personal use as it has special application for what I'm doing, but I believe you could use vec.size() and only need a vector as a param