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

Suspectable lines on tests/test_tensor.cpp ? #57

Closed
yuki-inaho opened this issue Aug 8, 2022 · 1 comment
Closed

Suspectable lines on tests/test_tensor.cpp ? #57

yuki-inaho opened this issue Aug 8, 2022 · 1 comment

Comments

@yuki-inaho
Copy link

yuki-inaho commented Aug 8, 2022

Thank you for your great job. I'm enjoying your tools as combining the OpenCV framework like below repository.
It seems a very kind and sophisticated tool at least for me.
https://github.com/yuki-inaho/nanobind_opencv_exercise

Suspectable lines (for me)

I noticed below code lines (especially the 83-th line) on the test code are a little suspectable for me.
To be exact, size_t x = 0; x < tensor.shape(1); ++x will be correct.
Please sorry if something is wrong, thank you.

m.def("process", [](nb::tensor<uint8_t, nb::shape<nb::any, nb::any, 3>,
nb::c_contig, nb::device::cpu> tensor) {
// Double brightness of the MxNx3 RGB image
for (size_t y = 0; y < tensor.shape(0); ++y)
for (size_t x = 0; y < tensor.shape(1); ++x)
for (size_t ch = 0; ch < 3; ++ch)
tensor(y, x, ch) = (uint8_t) std::min(255, tensor(y, x, ch) * 2);
});

@wjakob
Copy link
Owner

wjakob commented Aug 23, 2022

Yes, that is clearly a mistake -- thanks!

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