Tensor_at unit test.
@@ -31,13 +31,19 @@ int test_image() {
(float *) test_hwc_data);
blueoil::Tensor test_chw_hwc = blueoil::image::Tensor_CHW_to_HWC(test_chw);
blueoil::Tensor test_hwc_chw = blueoil::image::Tensor_HWC_to_CHW(test_hwc);
+
+ float *rgb = blueoil::image::Tensor_at(test_hwc, 1, 0);
+ if ((rgb[0] != 255) || (rgb[1] != 255) || (rgb[2] != 0)) {
+ std::cerr << "test_image: at(1, 0) != (255,255,0)" << std::endl;
+ test_hwc.dump();
+ return EXIT_FAILURE;
+ }
if (test_chw.allequal(test_hwc_chw) == false) {
std::cerr << "test_image: test_chw != test_hwc_chw" << std::endl;
test_chw.dump();
test_hwc_chw.dump();
return EXIT_FAILURE;
}
-
if (test_hwc.allequal(test_chw_hwc) == false) {
std::cerr << "test_image: test_hwc != test_chw_hwc" << std::endl;
test_hwc.dump();
