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/02/13 03:28:03 UTC
[GitHub] parallelgithub commented on issue #9771: Modify NDArrayIter constructor to receive tuple (i.e. dict in Python)?
parallelgithub commented on issue #9771: Modify NDArrayIter constructor to receive tuple (i.e. dict in Python)?
URL: https://github.com/apache/incubator-mxnet/pull/9771#issuecomment-365139987
Adding an additional constructor is our first consideration. But after observing the original interface:
```scala
class NDArrayIter (data: IndexedSeq[NDArray], label: IndexedSeq[NDArray] = IndexedSeq.empty,
private val dataBatchSize: Int = 1, shuffle: Boolean = false,
lastBatchHandle: String = "pad",
dataName: String = "data", labelName: String = "label") extends DataIter {...
```
we found there is no position to place the custom names. Therefore, since each overloading constructor has to call primary constructor, keeping the original interface may not a possible way if we want to make using multiple input flexible.
Another reason we modifying the existing constructor is that we observer the fields defined in the class:
```scala
val initData: IndexedSeq[(String, NDArray)] = IO.initData(_dataList, false, dataName)
val initLabel: IndexedSeq[(String, NDArray)] = IO.initData(_labelList, true, labelName)
```
We guess maybe using the type `IndexedSeq[(String, NDArray)] ` is the original motivation at the beginning.
In Python there is a [way](https://github.com/apache/incubator-mxnet/blob/master/python/mxnet/io.py#L490) to manipulate multiple input. But Scala is static type. Maybe we can try to rethink about the API interface design.
----------------------------------------------------------------
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