stu1130 commented on a change in pull request #12131: [MXNET-737][WIP] Add last 
batch handle for imageiter
URL: https://github.com/apache/incubator-mxnet/pull/12131#discussion_r210444554
 
 

 ##########
 File path: python/mxnet/image/image.py
 ##########
 @@ -1207,8 +1230,25 @@ def next(self):
         except StopIteration:
             if not i:
                 raise StopIteration
+        return i
 
-        return io.DataBatch([batch_data], [batch_label], batch_size - i)
+    def next(self):
+        """Returns the next batch of data."""
+        batch_size = self.batch_size
+        c, h, w = self.data_shape
+        batch_data = nd.empty((batch_size, c, h, w))
+        batch_label = nd.empty(self.provide_label[0][1])
+        i = self._batchify(batch_data, batch_label)
+        # calculate the padding
+        pad = batch_size - i
+        # handle padding for 'pad' and 'roll_over' for the last batch
+        if pad != 0:
+            if self.last_batch == 'discard':
 
 Review comment:
   change the padding logic here

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to