InvalidArgumentError:未注册OpKernel以支持Op' Resampler'与这些attrs

时间:2017-09-16 09:13:59

标签: tensorflow tensorflow-gpu

我是tensorflow的新手,正在玩重新采样器操作(作为cv2重映射功能的替代方案),当我运行会话来评估节点' out&#39时似乎得到此错误;。这是我的代码段

print(warpmap.dtype,warpmap.shape) #prints float32 dtype and (1, 266, 400, 2) shape
print(img.dtype,img.shape) #prints float32 dtype and (1, 266, 400, 3) shape
tf_img = tf.placeholder(tf.float32,[1,None,None,None])
tf_warp = tf.placeholder(tf.float32,[1,None,None,2])
out = tf.contrib.resampler.resampler(tf_img,tf_warp)
sess = tf.Session()
sess.run(out,{tf_img:img,tf_warp:warpmap})

我已经在这里跟进了任何相关问题或github上的问题,但无法找到出路。请让我知道如何解决这个问题。错误消息如下

---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
F:\Sharath\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\client\session.py in _do_call(self, fn, *args)
   1326     try:
-> 1327       return fn(*args)
   1328     except errors.OpError as e:

F:\Sharath\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\client\session.py in _run_fn(session, feed_dict, fetch_list, target_list, options, run_metadata)
   1296       # Ensure any changes to the graph are reflected in the runtime.
-> 1297       self._extend_graph()
   1298       with errors.raise_exception_on_not_ok_status() as status:

F:\Sharath\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\client\session.py in _extend_graph(self)
   1357           tf_session.TF_ExtendGraph(
-> 1358               self._session, graph_def.SerializeToString(), status)
   1359         self._opened = True

F:\Sharath\Anaconda\envs\tensorflow-gpu\lib\contextlib.py in __exit__(self, type, value, traceback)
     65             try:
---> 66                 next(self.gen)
     67             except StopIteration:

F:\Sharath\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\framework\errors_impl.py in raise_exception_on_not_ok_status()
    465           compat.as_text(pywrap_tensorflow.TF_Message(status)),
--> 466           pywrap_tensorflow.TF_GetCode(status))
    467   finally:

InvalidArgumentError: No OpKernel was registered to support Op 'Resampler' with these attrs.  Registered devices: [CPU,GPU], Registered kernels:
  <no registered kernels>

     [[Node: resampler/Resampler = Resampler[T=DT_FLOAT](Placeholder, Placeholder_1)]]

During handling of the above exception, another exception occurred:

InvalidArgumentError                      Traceback (most recent call last)
<ipython-input-1-594940a14782> in <module>()
     39     #sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True))
     40     #sess.run(tf.global_variables_initializer())
---> 41     sess.run(out,{tf_img:img,tf_warp:warpmap})
     42     print('done')
     43     cv2.waitKey(0)

F:\Sharath\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\client\session.py in run(self, fetches, feed_dict, options, run_metadata)
    893     try:
    894       result = self._run(None, fetches, feed_dict, options_ptr,
--> 895                          run_metadata_ptr)
    896       if run_metadata:
    897         proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

F:\Sharath\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\client\session.py in _run(self, handle, fetches, feed_dict, options, run_metadata)
   1122     if final_fetches or final_targets or (handle and feed_dict_tensor):
   1123       results = self._do_run(handle, final_targets, final_fetches,
-> 1124                              feed_dict_tensor, options, run_metadata)
   1125     else:
   1126       results = []

F:\Sharath\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\client\session.py in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)
   1319     if handle is None:
   1320       return self._do_call(_run_fn, self._session, feeds, fetches, targets,
-> 1321                            options, run_metadata)
   1322     else:
   1323       return self._do_call(_prun_fn, self._session, handle, feeds, fetches)

F:\Sharath\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\client\session.py in _do_call(self, fn, *args)
   1338         except KeyError:
   1339           pass
-> 1340       raise type(e)(node_def, op, message)
   1341 
   1342   def _extend_graph(self):

0 个答案:

没有答案