mxnet scala использует ошибку one_hot params - PullRequest
0 голосов
/ 28 мая 2018
object LoadTest1 {
def main(args: Array[String]): Unit = {

var b = NDArray.array(Array(1, 2, 3),
    shape = Shape(1, 3))
//var c = b.copy()
val a = NDArray.one_hot(Map("indices" -> NDArray.array(Array(1f, 2f, 3f), shape = Shape(1, 3)),
    "on_value" -> 1,
    "dtype" -> "float16",
    "off_value" -> 0,
    "depth" -> 4
    //                        "out"->c
))(1)(1)
println(a)

println("-----------------------")
}
}

Код выполняется с такой ошибкой:

    Exception in thread "main" ml.dmlc.mxnet.MXNetError: Cannot find argument 'indices', Possible Arguments:

    depth : int, required
        Depth of the one hot dimension.
    on_value : double, optional, default=1
        The value assigned to the locations represented by indices.
    off_value : double, optional, default=0
        The value assigned to the locations not represented by indices.
    dtype : {'float16', 'float32', 'float64', 'int32', 'uint8'},optional, default='float32'
    18/05/28 17:19:19 INFO util.NativeLibraryLoader: Deleting /var/folders/xh/cjnxxqwx05q4rmf3rz5zmt1r0000gn/T/mxnet4026866899089746779/mxnet-scala
        DType of the output
    18/05/28 17:19:19 INFO util.NativeLibraryLoader: Deleting /var/folders/xh/cjnxxqwx05q4rmf3rz5zmt1r0000gn/T/mxnet4026866899089746779
    , in operator one_hot(name="", depth="1", on_value="1", off_value="0", indices="ml.dmlc.mxnet.NDArray@c3b177e",

dtype = "float16") в ml.dmlc.mxnet.Base $ .checkCall (Base.scala: 131) в ml.dmlc.mxnet.NDArray $ .genericNDArrayFunctionInvoke (NDArray.scala: 97) в ml.dmlc.mxnet.NDArray $ .one_hot (NDArray.scala: 33) на LoadTest $ .main (LoadTest.scala: 22)LoadTest.main (LoadTest.scala)

I think I add the "indices".

I am not very familiar with mxnet Scala, so what's wrong with this?

1 Ответ

0 голосов
/ 29 мая 2018
val aa = NDArray.one_hot(NDArray.array(Array(1,2,3,4),shape = Shape(4)),4,1,0,"int32")

Я считаю, что карта не нужна как параметр. Так же, как и код, который она работает.

...