zhreshold 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_r210182985
##########
File path: python/mxnet/image/image.py
##########
@@ -1207,8 +1237,28 @@ 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.iterate(batch_data, batch_label)
+ # calculate the padding
+ pad = batch_size - i
+ # handle padding for sequential read
+ if pad != 0:
+ if self.seq is not None:
Review comment:
the logic of last_batch here is kind weird
----------------------------------------------------------------
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