{"action":"created","issue":{"url":"https://api.github.com/repos/PaddlePaddle/Paddle/issues/13899","repository_url":"https://api.github.com/repos/PaddlePaddle/Paddle","labels_url":"https://api.github.com/repos/PaddlePaddle/Paddle/issues/13899/labels{/name}","comments_url":"https://api.github.com/repos/PaddlePaddle/Paddle/issues/13899/comments","events_url":"https://api.github.com/repos/PaddlePaddle/Paddle/issues/13899/events","html_url":"https://github.com/PaddlePaddle/Paddle/issues/13899","id":370123592,"node_id":"MDU6SXNzdWUzNzAxMjM1OTI=","number":13899,"title":"paddle.fluid.core.EnforceNotMet: op gather does not have kernel for data_type ...","user":{"login":"LihangLiu","id":8502179,"node_id":"MDQ6VXNlcjg1MDIxNzk=","avatar_url":"https://avatars2.githubusercontent.com/u/8502179?v=4","gravatar_id":"","url":"https://api.github.com/users/LihangLiu","html_url":"https://github.com/LihangLiu","followers_url":"https://api.github.com/users/LihangLiu/followers","following_url":"https://api.github.com/users/LihangLiu/following{/other_user}","gists_url":"https://api.github.com/users/LihangLiu/gists{/gist_id}","starred_url":"https://api.github.com/users/LihangLiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LihangLiu/subscriptions","organizations_url":"https://api.github.com/users/LihangLiu/orgs","repos_url":"https://api.github.com/users/LihangLiu/repos","events_url":"https://api.github.com/users/LihangLiu/events{/privacy}","received_events_url":"https://api.github.com/users/LihangLiu/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-10-15T11:42:44Z","updated_at":"2018-10-31T07:48:15Z","closed_at":"2018-10-31T07:38:10Z","author_association":"NONE","body":"请问在用layers.gather的时候，碰到如下error是什么原因呢，issue里面没找到：\r\n\r\n`Traceback (most recent call last):\r\n  File \"test.py\", line 33, in <module>\r\n    y_value = exe.run(main_program, feed={'x': x_tensor, 'ids':id_tensor}, fetch_list=[y])\r\n  File \"/home/disk2/ol/tools/anaconda2/envs/paddle/lib/python2.7/site-packages/paddle/fluid/executor.py\", line 470, in run\r\n    self.executor.run(program.desc, scope, 0, True, True)\r\n\r\npaddle.fluid.core.EnforceNotMet: op gather does not have kernel for data_type[int64_t]:data_layout[ANY_LAYOUT]:place[CUDAPlace(0)]:library_type[PLAIN] at [/work/workspace/Paddle/paddle/fluid/framework/operator.cc:678]\r\nPaddlePaddle Call Stacks: \r\n0       0x7f2ada55007cp paddle::platform::EnforceNotMet::EnforceNotMet(std::__exception_ptr::exception_ptr, char const*, int) + 572\r\n1       0x7f2adb5d7262p paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, boost::variant<paddle::platform::CUDAPlace, paddle::platform::CPUPlace, paddle::platform::CUDAPinnedPlace, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_> const&) const + 1522\r\n2       0x7f2adb5d2354p paddle::framework::OperatorBase::Run(paddle::framework::Scope const&, boost::variant<paddle::platform::CUDAPlace, paddle::platform::CPUPlace, paddle::platform::CUDAPinnedPlace, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_> const&) + 292\r\n3       0x7f2ada63ff8fp paddle::framework::Executor::RunPreparedContext(paddle::framework::ExecutorPrepareContext*, paddle::framework::Scope*, bool, bool, bool) + 559\r\n4       0x7f2ada640ddap paddle::framework::Executor::Run(paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool) + 154\r\n5       0x7f2ada5317f2p\r\n6       0x7f2ada570dc4p pybind11::cpp_function::dispatcher(_object*, _object*, _object*) + 1236\r\n7       0x7f2b70749fc7p PyEval_EvalFrameEx + 28695\r\n8       0x7f2b7074c4e9p PyEval_EvalCodeEx + 2025\r\n9       0x7f2b707499b8p PyEval_EvalFrameEx + 27144\r\n10      0x7f2b7074c4e9p PyEval_EvalCodeEx + 2025\r\n11      0x7f2b7074c70ap PyEval_EvalCode + 26\r\n12      0x7f2b707659cdp\r\n13      0x7f2b70766b48p PyRun_FileExFlags + 120\r\n14      0x7f2b70767d68p PyRun_SimpleFileExFlags + 232\r\n15      0x7f2b70779f8cp Py_Main + 2988\r\n16      0x7f2b6f9b2bd5p __libc_start_main + 245\r\n17      0x7f2b70a478bfp`\r\n\r\n源代码如下：\r\n`\r\nimport paddle\r\nimport paddle.fluid as fluid\r\nfrom paddle.fluid import layers\r\nimport numpy as np\r\n\r\ndef net():\r\n~~x = layers.data(name='x', shape=[2], dtype='float32', lod_level=0)\r\n~~ids = layers.data(name='ids', shape=[-1], dtype='int64', lod_level=0)\r\n~~y = layers.gather(x, ids)\r\n~~return y\r\n\r\n\r\nmain_program = fluid.Program()\r\nwith fluid.program_guard(main_program):\r\n~~y = net()\r\n\r\nplace = fluid.CUDAPlace(0)\r\nexe = fluid.Executor(place)\r\nexe.run(fluid.default_startup_program())\r\n\r\narray = np.zeros([10, 2], dtype=int)\r\nx_tensor = fluid.LoDTensor()\r\nx_tensor.set(array, place)\r\nx_tensor.set_lod([])\r\n\r\narray = np.array([0, 3, 7], dtype=int)\r\nid_tensor = fluid.LoDTensor()\r\nid_tensor.set(array, place)\r\nid_tensor.set_lod([])\r\n\r\ny_value = exe.run(main_program, feed={'x': x_tensor, 'ids':id_tensor}, fetch_list=[y])\r\nprint ('return', y_value)\r\n`\r\n\r\n谢谢！"},"comment":{"url":"https://api.github.com/repos/PaddlePaddle/Paddle/issues/comments/434591768","html_url":"https://github.com/PaddlePaddle/Paddle/issues/13899#issuecomment-434591768","issue_url":"https://api.github.com/repos/PaddlePaddle/Paddle/issues/13899","id":434591768,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNDU5MTc2OA==","user":{"login":"cserken","id":5810937,"node_id":"MDQ6VXNlcjU4MTA5Mzc=","avatar_url":"https://avatars3.githubusercontent.com/u/5810937?v=4","gravatar_id":"","url":"https://api.github.com/users/cserken","html_url":"https://github.com/cserken","followers_url":"https://api.github.com/users/cserken/followers","following_url":"https://api.github.com/users/cserken/following{/other_user}","gists_url":"https://api.github.com/users/cserken/gists{/gist_id}","starred_url":"https://api.github.com/users/cserken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cserken/subscriptions","organizations_url":"https://api.github.com/users/cserken/orgs","repos_url":"https://api.github.com/users/cserken/repos","events_url":"https://api.github.com/users/cserken/events{/privacy}","received_events_url":"https://api.github.com/users/cserken/received_events","type":"User","site_admin":false},"created_at":"2018-10-31T07:48:15Z","updated_at":"2018-10-31T07:48:15Z","author_association":"NONE","body":"为什么gather这个op只能支持特定的数据类型呢?"}}
{"actor":{"display_login":"cserken"}}