mxnet scala 使用 one_hot 参数错误
mxnet scala use one_hot params error
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("-----------------------")
}
}
The code runs with an error like this :
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")
at ml.dmlc.mxnet.Base$.checkCall(Base.scala:131)
at ml.dmlc.mxnet.NDArray$.genericNDArrayFunctionInvoke(NDArray.scala:97)
at ml.dmlc.mxnet.NDArray$.one_hot(NDArray.scala:33)
at LoadTest$.main(LoadTest.scala:22)
at LoadTest.main(LoadTest.scala)
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")
我发现它不需要像它工作的代码那样 param.Just 的地图。
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("-----------------------")
}
}
The code runs with an error like this :
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") at ml.dmlc.mxnet.Base$.checkCall(Base.scala:131) at ml.dmlc.mxnet.NDArray$.genericNDArrayFunctionInvoke(NDArray.scala:97) at ml.dmlc.mxnet.NDArray$.one_hot(NDArray.scala:33) at LoadTest$.main(LoadTest.scala:22) at LoadTest.main(LoadTest.scala)
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")
我发现它不需要像它工作的代码那样 param.Just 的地图。