You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/06/15 15:46:29 UTC

[GitHub] yzhliu commented on a change in pull request #11256: [MXNET-539] Allow Scala users to specify data/label names for NDArrayIter

yzhliu commented on a change in pull request #11256: [MXNET-539] Allow Scala users to specify data/label names for NDArrayIter
URL: https://github.com/apache/incubator-mxnet/pull/11256#discussion_r195782399
 
 

 ##########
 File path: scala-package/core/src/main/scala/org/apache/mxnet/io/NDArrayIter.scala
 ##########
 @@ -154,16 +171,16 @@ class NDArrayIter (data: IndexedSeq[NDArray], label: IndexedSeq[NDArray] = Index
     newArray
   }
 
-  private def _getData(data: IndexedSeq[NDArray]): IndexedSeq[NDArray] = {
+  private def _getData(data: IndexedSeq[(String, NDArray)]): IndexedSeq[NDArray] = {
     require(cursor < numData, "DataIter needs reset.")
     if (data == null) {
       null
     } else {
       if (cursor + dataBatchSize <= numData) {
-        data.map(ndArray => {ndArray.slice(cursor, cursor + dataBatchSize)}).toIndexedSeq
+        data.map { case (_, ndArray) => ndArray.slice(cursor, cursor + dataBatchSize) }
 
 Review comment:
   In `next()` it returns `DataBatch` and `DataBatch` can be disposed thus dispose the sliced data/label. For now it is a standard process for `DataIter`s. Users can decide to use the returned DataBatch later thus we cannot dispose them 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:
users@infra.apache.org


With regards,
Apache Git Services