Implemented a regression unit test for #11793 (#12975)
Implemented a regression unit test for #11793 (#12975)

When using C++-based iterators, it's important that only a single batch is referenced at a time. Because C++
iterators are exposed to the Python code through a C API, there is no concept of reference counting. Hence,
typically C++ iterators will deallocate a batch when next() is called on them. So, we need to make sure the Python
code only references a single batch at a time, otherwise the Python code will attempt to access freed memory,
resulting in either (a) garbage accuracy or (b) a segmentation fault.

The test passes with the latest mxnet build. I verified it failed on previous releases, such as mxnet==1.2.0.
apache/incubator-mxnet,larroy/mxnet,leezu/mxnet,leezu/mxnet,ForkedReposBak/mxnet,ForkedReposBak/mxnet,eric-haibin-lin/mxnet,sxjscience/mxnet,szha/mxnet,zhreshold/mxnet,eric-haibin-lin/mxnet,DickJC123/mxnet,ForkedReposBak/mxnet,ptrendx/mxnet,szha/mxnet,ptrendx/mxnet,sxjscience/mxnet,yajiedesign/mxnet,zhreshold/mxnet,dmlc/mxnet,leezu/mxnet,leezu/mxnet,ForkedReposBak/mxnet,apache/incubator-mxnet,ptrendx/mxnet,ForkedReposBak/mxnet,reminisce/mxnet,DickJC123/mxnet,leezu/mxnet,ptrendx/mxnet,tlby/mxnet,sxjscience/mxnet,dmlc/mxnet,tlby/mxnet,zhreshold/mxnet,dmlc/mxnet,dmlc/mxnet,tlby/mxnet,leezu/mxnet,larroy/mxnet,dmlc/mxnet,zhreshold/mxnet,szha/mxnet,larroy/mxnet,apache/incubator-mxnet,tlby/mxnet,ptrendx/mxnet,larroy/mxnet,eric-haibin-lin/mxnet,eric-haibin-lin/mxnet,reminisce/mxnet,reminisce/mxnet,dmlc/mxnet,larroy/mxnet,reminisce/mxnet,sxjscience/mxnet,ptrendx/mxnet,yajiedesign/mxnet,yajiedesign/mxnet,eric-haibin-lin/mxnet,zhreshold/mxnet,eric-haibin-lin/mxnet,sxjscience/mxnet,yajiedesign/mxnet,tlby/mxnet,apache/incubator-mxnet,tlby/mxnet,szha/mxnet,reminisce/mxnet,zhreshold/mxnet,tlby/mxnet,dmlc/mxnet,zhreshold/mxnet,DickJC123/mxnet,ForkedReposBak/mxnet,szha/mxnet,ptrendx/mxnet,reminisce/mxnet,eric-haibin-lin/mxnet,sxjscience/mxnet,leezu/mxnet,reminisce/mxnet,reminisce/mxnet,ptrendx/mxnet,yajiedesign/mxnet,larroy/mxnet,ForkedReposBak/mxnet,tlby/mxnet,reminisce/mxnet,larroy/mxnet,ptrendx/mxnet,szha/mxnet,reminisce/mxnet,eric-haibin-lin/mxnet,sxjscience/mxnet,yajiedesign/mxnet,zhreshold/mxnet,yajiedesign/mxnet,leezu/mxnet,ForkedReposBak/mxnet,dmlc/mxnet,larroy/mxnet,tlby/mxnet,sxjscience/mxnet,yajiedesign/mxnet,larroy/mxnet,yajiedesign/mxnet,tlby/mxnet,ForkedReposBak/mxnet,sxjscience/mxnet,zhreshold/mxnet,leezu/mxnet,dmlc/mxnet,szha/mxnet,DickJC123/mxnet,ptrendx/mxnet,eric-haibin-lin/mxnet,szha/mxnet,szha/mxnet