mxnet scala使用一个热参数错误
代码运行时会出现如下错误:mxnet scala使用一个热参数错误,scala,mxnet,one-hot-encoding,Scala,Mxnet,One Hot Encoding,代码运行时会出现如下错误: 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,
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("-----------------------")
}
}
dtype=“float16”)
位于ml.dmlc.mxnet.Base$.checkCall(Base.scala:131)
位于ml.dmlc.mxnet.NDArray$.genericndarayFunctionInvoke(NDArray.scala:97)
在ml.dmlc.mxnet.NDArray$.one_hot(NDArray.scala:33)
在LoadTest$.main处(LoadTest.scala:22)
位于LoadTest.main(LoadTest.scala)
我发现它不需要像param那样的映射,就像它工作的代码一样
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",
I think I add the "indices".
I am not very familiar with mxnet Scala, so what's wrong with this?
val aa = NDArray.one_hot(NDArray.array(Array(1,2,3,4),shape = Shape(4)),4,1,0,"int32")