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

Libtorch batch input #29

Open
zhjw0927 opened this issue Oct 9, 2019 · 2 comments
Open

Libtorch batch input #29

zhjw0927 opened this issue Oct 9, 2019 · 2 comments

Comments

@zhjw0927
Copy link

zhjw0927 commented Oct 9, 2019

I have a question.
In inference stage, I want to set batch to four, processing four channels of video at the same time.
How should I do? Thank you !

@walktree
Copy link
Owner

walktree commented Oct 9, 2019

Input data are supposed to be NHWC format in Pytorch, in the example, N = 1:
auto img_tensor = torch::CPU(torch::kFloat32).tensorFromBlob(img_float.data, {1, input_image_size, input_image_size, 3});
So you should create a tensor with four images data, and the "write_results" function should be updated too.

@zhjw0927
Copy link
Author

zhjw0927 commented Oct 9, 2019

I'm sorry that I‘m not very clear it. Do you think I am writing this right?
at::Tensor img_tensor = torch::from_blob(img1.data, img2.data, img3.data, img4.data, {1, input_image_size, input_image_size, 3});
Or, do you mind writing one for me?
Thank you very much!

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

2 participants