dmlc/mshadow

About getting the shape of a tensor

AIROBOTAI opened this issue · 1 comments

Hi all, I'm a newbie in mxnet, I can not understand why I got those results from the following code snippet:

TensorContainer<cpu, 2> lhs(Shape2(2, 3));
lhs = 1.0;
printf("%u %u\n", lhs.size(0), lhs.size(1));
printf("%u %u\n", lhs[0].shape_[0], lhs[0].shape_[1]);
printf("%u %u\n", lhs[0].size(0), lhs[0].size(1));

The output is:

2 3
3 4
3 3

Why are the second and third outputs those numbers? Because lhs[0] is one-dimensional, I think they should be exactly the same, i.e. 3 0. Could anyone tell me where I was wrong? Thanks in advance!

szha commented

This code base has been donated to the Apache MXNet project per #373, and repo is deprecated. Future development and issue tracking should continue in Apache MXNet.