This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Tensor bug in the latest version (3.3.3)

Tags: None
(comma "," separated)
netw0rkf10w
Registered Member
Posts
8
Karma
0
Hello,

It seems to me that Eigen 3.3.3 (released February 21, 2017) has some bug in the Tensor module. I tested the following simple example (taken from the official README):

Code: Select all

#include <Eigen/Dense>
#include <unsupported/Eigen/CXX11/Tensor>
using namespace Eigen;
int main(int argc, char *argv[])
{
    // Map a tensor of ints on top of stack-allocated storage.   
    int storage[128];  // 2 x 4 x 2 x 8 = 128
    TensorMap<int, 4> t_4d(storage, 2, 4, 2, 8);
    return 0;
}


and got an error:

main.cpp:121: error: no matching function for call to ‘Eigen::TensorMap<int, 4>::TensorMap(int [128], int, int, int, int)’
TensorMap<int, 4> t_4d( storage, 2, 4, 2, 8 );
^


Since registration is disabled on Eigen Bugzilla, I could not be able to report this bug.

Could anyone here please help me to temporarily fix this bug in waiting for the next release? I really need to do TensorMap in my code. And please report this bug to the developers, too.

Thank you very much in advance for your help!
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
There is a typo in the doc. It should be:
Code: Select all
TensorMap<Tensor<int, 4> > t_4d(storage, 2, 4, 2, 8);
netw0rkf10w
Registered Member
Posts
8
Karma
0
ggael wrote:There is a typo in the doc. It should be:
Code: Select all
TensorMap<Tensor<int, 4> > t_4d(storage, 2, 4, 2, 8);

Thanks, Gael. This does the trick. However, when changing the type from int to double:

Code: Select all
double storage[128];  // 2 x 4 x 2 x 8 = 128
TensorMap< Tensor<double, 4> > t_4d(storage, 2, 4, 2, 8);


I obtained the following errors:

error: no matching function for call to ‘Eigen::DSizes<long int, 4>::DSizes(const int [4])’
: m_data(dataPtr), m_dimensions(dimensions)
^
error: invalid conversion from ‘const int*’ to ‘long int’ [-fpermissive]
: m_data(dataPtr), m_dimensions(dimensions)
^

Could you please tell me how to fix this?

P/s: also thanks for creating my BugZilla account.
netw0rkf10w
Registered Member
Posts
8
Karma
0
Sorry I have successfully compiled it. Not sure what happened. Thanks again, Gael!


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]