mod.bind()

时间:2018-06-06 16:37:20

标签: python mxnet

描述

必须为one_hot运算符设置索引类型,但我找不到在何处或如何设置它。

环境信息

---------- Python Info ----------

版本:3.6.5

编译器:GCC 7.2.0

构建:('默认',' 2018年4月29日16:14:56')

Arch :(' 64bit','')

------------ Pip Info -----------

版本:10.0.1

目录:/home/augustinas/anaconda3/envs/mxnet/lib/python3.6/site-packages/pip

---------- MXNet Info -----------

版本:1.3.0

目录:/home/augustinas/anaconda3/envs/mxnet/lib/python3.6/site-packages/mxnet

提交哈希:247d57944f7a989d8f445856769e704b83765828

----------系统信息----------

平台:Linux-4.13.0-43-generic-x86_64-with-debian-stretch-sid

系统:Linux

节点:augustinasNT

发布:4.13.0-43-generic

版本:#48~16.04.1-Ubuntu SMP Thu May 17 12:56:46 UTC 2018

错误消息:

RuntimeError:simple_bind错误。参数:

数据:(1,3,112,112)

运算符one_hot0出错:[19:29:50] src / operator / tensor /./ indexing_op.h:1002:检查失败:(* in_attrs)[0]!= -1(-1 vs. -1 )必须为one_hot运算符设置索引类型

堆栈跟踪返回10个条目:

[bt](0)/home/augustinas/anaconda3/envs/mxnet/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x1d7c2a)[0x7fd3b2363c2a]

[bt](1)/home/augustinas/anaconda3/envs/mxnet/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x1d8261)[0x7fd3b2364261]

[bt](2)/home/augustinas/anaconda3/envs/mxnet/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x211641f)[0x7fd3b42a241f]

[bt](3)/home/augustinas/anaconda3/envs/mxnet/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x2672116)[0x7fd3b47fe116]

[bt](4)/home/augustinas/anaconda3/envs/mxnet/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x267b971)[0x7fd3b4807971]

[bt](5)/home/augustinas/anaconda3/envs/mxnet/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x267c3ca)[0x7fd3b48083ca]

[bt](6)/home/augustinas/anaconda3/envs/mxnet/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x266ca22)[0x7fd3b47f8a22]

[bt](7)/home/augustinas/anaconda3/envs/mxnet/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x266d434)[0x7fd3b47f9434]

[bt](8)/home/augustinas/anaconda3/envs/mxnet/lib/python3.6/site-packages/mxnet/libmxnet.so(MXExecutorSimpleBind+0x2378)[0x7fd3b47574a8]

[bt](9)/home/augustinas/anaconda3/envs/mxnet/lib/python3.6/lib-dynload/../../libffi.so.6(ffi_call_unix64+0x4c)[0x7fd3cf795ec0] < / p>

1 个答案:

答案 0 :(得分:1)

因此,查看one_hot的文档,您需要提供两个参数,indicesdepth这些都是必需的。 mx.symbol.one_hotmx.ndarray.one_hot需要类似的参数,但indices的类型分别为Symbol和NDArray。

1)indices(类型为NDArray / Symbol):设置on_value的位置数组

2)depth(类型为int):一个热维度的深度(即类的数量)

这样的例子如下:

one_hot([1,0,2,0], 3) = [[ 0.  1.  0.]
                         [ 1.  0.  0.]
                         [ 0.  0.  1.]
                         [ 1.  0.  0.]]