提交 f3274a24 编写于 作者: S superjom

add channel support

上级 438a934e
......@@ -21,6 +21,9 @@ class LibTest(unittest.TestCase):
add_image(writer, "train", "layer/image0", 7, 10, 1)
add_image(writer, "test", "layer/image0", 7, 10, 3)
add_image(writer, "train", "layer/image1", 7, 10, 1, shape=[30,30,2])
add_image(writer, "test", "layer/image1", 7, 10, 1, shape=[30,30,2])
self.reader = storage.StorageReader(dir)
def test_modes(self):
......
......@@ -103,6 +103,10 @@ void Image::SetSample(int index,
int size = std::accumulate(
shape.begin(), shape.end(), 1., [](float a, float b) { return a * b; });
CHECK_GT(size, 0);
CHECK_EQ(shape.size(), 3)
<< "shape should be something like (width, height, num_channel)";
CHECK_LE(shape.back(), 3);
CHECK_GE(shape.back(), 2);
CHECK_EQ(size, data.size()) << "image's shape not match data";
CHECK_LT(index, num_samples_);
CHECK_LE(index, num_records_);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册