tensorflow-tutorial icon indicating copy to clipboard operation
tensorflow-tutorial copied to clipboard

tensorflow-tutorial/cpp/src/ann_model_loader.cpp

Open Edwardmark opened this issue 7 years ago • 1 comments

line 43, what does this line mean? what does the <float, 2> mean? what does x_map(0, j) = (*vec)[j]; mean?

auto x_map = x.tensor<float, 2>(); for (int j = 0; j < ndim; j++) { x_map(0, j) = (*vec)[j]; }

Edwardmark avatar Nov 02 '17 13:11 Edwardmark

我现在想输入一张1160160 *3的图片,这里该怎么改?下面这种改法对吗? // Create New tensor and set value Tensor x(tensorflow::DT_FLOAT, tensorflow::TensorShape({1, 160, 160, 3})); // New Tensor shape [1, 160, 160, 3] auto x_map = x.tensor<float, 160 * 160 * 3>(); for (int j = 0; j < 160 * 160 * 3; j++) { x_map(0, j) = (*vec)[j]; }

Edwardmark avatar Nov 02 '17 13:11 Edwardmark