anirudhacharya commented on a change in pull request #12485: 
test_ImageRecordIter_seed_augmentation flaky test fix
URL: https://github.com/apache/incubator-mxnet/pull/12485#discussion_r237215452
 
 

 ##########
 File path: tests/python/unittest/test_io.py
 ##########
 @@ -427,13 +434,43 @@ def check_CSVIter_synthetic(dtype='float32'):
     for dtype in ['int32', 'int64', 'float32']:
         check_CSVIter_synthetic(dtype=dtype)
 
[email protected]("Flaky test: 
https://github.com/apache/incubator-mxnet/issues/11359";)
 def test_ImageRecordIter_seed_augmentation():
     get_cifar10()
     seed_aug = 3
 
+    def assert_dataiter_equals(dataiter1, dataiter2):
+        for batch1, batch2 in zip_longest(dataiter1, dataiter2):
+            # ensure iterators are of same length
+            assert(batch1 and batch2)
+
+            # ensure batches are of same length
+            assert(len(batch1.data) == len(batch2.data))
+
+            # ensure batch data is the same
+            for i in range(0, len(batch1.data)):
+                data1 = batch1.data[i].asnumpy().astype(np.uint8)
+                data2 = batch2.data[i].asnumpy().astype(np.uint8)
+                assert(np.array_equal(data1, data2))
+
+    def assert_dataiter_not_equals(dataiter1, dataiter2):
+        for batch1, batch2 in zip_longest(dataiter1, dataiter2):
+
+            # try to ensure iterators are of same length
+            assert(batch1 and batch2)
 
 Review comment:
   how is this ensuring same length?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to