Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tensorflow-tutorial/cpp/src/ann_model_loader.cpp #4

Open
Edwardmark opened this issue Nov 2, 2017 · 1 comment
Open

tensorflow-tutorial/cpp/src/ann_model_loader.cpp #4

Edwardmark opened this issue Nov 2, 2017 · 1 comment

Comments

@Edwardmark
Copy link

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
Copy link
Author

Edwardmark commented Nov 2, 2017

我现在想输入一张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];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant