请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

运行报这个错误

老师,代码运行有错,
代码就不粘了,因为和您的代码是一样的(我把您的文件直接打开的),现在报如下错误

---------------------------------------------------------------------------
UnknownError                              Traceback (most recent call last)
c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tensorflow\python\client\session.py in _do_call(self, fn, *args)
   1355     try:
-> 1356       return fn(*args)
   1357     except errors.OpError as e:

c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tensorflow\python\client\session.py in _run_fn(feed_dict, fetch_list, target_list, options, run_metadata)
   1340       return self._call_tf_sessionrun(
-> 1341           options, feed_dict, fetch_list, target_list, run_metadata)
   1342 

c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tensorflow\python\client\session.py in _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list, run_metadata)
   1428         self._session, options, feed_dict, fetch_list, target_list,
-> 1429         run_metadata)
   1430 

UnknownError: 2 root error(s) found.
  (0) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
	 [[{{node conv1_1_1/Conv2D}}]]
	 [[add/_5]]
  (1) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
	 [[{{node conv1_1_1/Conv2D}}]]
0 successful operations.
0 derived errors ignored.

During handling of the above exception, another exception occurred:

UnknownError                              Traceback (most recent call last)
<ipython-input-4-77649cb8b1d2> in <module>
      8                      feed_dict = {
      9                          content: content_val,
---> 10                          style: style_val,
     11                      })
     12         print('step: %d, loss_value: %8.4f, content_loss: %8.4f, style_loss: %8.4f' 

c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tensorflow\python\client\session.py in run(self, fetches, feed_dict, options, run_metadata)
    948     try:
    949       result = self._run(None, fetches, feed_dict, options_ptr,
--> 950                          run_metadata_ptr)
    951       if run_metadata:
    952         proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tensorflow\python\client\session.py in _run(self, handle, fetches, feed_dict, options, run_metadata)
   1171     if final_fetches or final_targets or (handle and feed_dict_tensor):
   1172       results = self._do_run(handle, final_targets, final_fetches,
-> 1173                              feed_dict_tensor, options, run_metadata)
   1174     else:
   1175       results = []

c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tensorflow\python\client\session.py in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)
   1348     if handle is None:
   1349       return self._do_call(_run_fn, feeds, fetches, targets, options,
-> 1350                            run_metadata)
   1351     else:
   1352       return self._do_call(_prun_fn, handle, feeds, fetches)

c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tensorflow\python\client\session.py in _do_call(self, fn, *args)
   1368           pass
   1369       message = error_interpolation.interpolate(message, self._graph)
-> 1370       raise type(e)(node_def, op, message)
   1371 
   1372   def _extend_graph(self):

UnknownError: 2 root error(s) found.
  (0) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
	 [[node conv1_1_1/Conv2D (defined at <ipython-input-1-8c661ffe24a7>:31) ]]
	 [[add/_5]]
  (1) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
	 [[node conv1_1_1/Conv2D (defined at <ipython-input-1-8c661ffe24a7>:31) ]]
0 successful operations.
0 derived errors ignored.

Errors may have originated from an input operation.
Input Source operations connected to node conv1_1_1/Conv2D:
 conv1_1_1/conv (defined at <ipython-input-1-8c661ffe24a7>:18)	
 concat_1 (defined at <ipython-input-1-8c661ffe24a7>:82)

Input Source operations connected to node conv1_1_1/Conv2D:
 conv1_1_1/conv (defined at <ipython-input-1-8c661ffe24a7>:18)	
 concat_1 (defined at <ipython-input-1-8c661ffe24a7>:82)

Original stack trace for 'conv1_1_1/Conv2D':
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\ipykernel_launcher.py", line 16, in <module>
    app.launch_new_instance()
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\traitlets\config\application.py", line 664, in launch_instance
    app.start()
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\ipykernel\kernelapp.py", line 583, in start
    self.io_loop.start()
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tornado\platform\asyncio.py", line 149, in start
    self.asyncio_loop.run_forever()
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\asyncio\base_events.py", line 523, in run_forever
    self._run_once()
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\asyncio\base_events.py", line 1758, in _run_once
    handle._run()
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\asyncio\events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tornado\ioloop.py", line 690, in <lambda>
    lambda f: self._run_callback(functools.partial(callback, future))
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tornado\ioloop.py", line 743, in _run_callback
    ret = callback()
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tornado\gen.py", line 787, in inner
    self.run()
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tornado\gen.py", line 748, in run
    yielded = self.gen.send(value)
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\ipykernel\kernelbase.py", line 365, in process_one
    yield gen.maybe_future(dispatch(*args))
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tornado\gen.py", line 209, in wrapper
    yielded = next(result)
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\ipykernel\kernelbase.py", line 268, in dispatch_shell
    yield gen.maybe_future(handler(stream, idents, msg))
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tornado\gen.py", line 209, in wrapper
    yielded = next(result)
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\ipykernel\kernelbase.py", line 545, in execute_request
    user_expressions, allow_stdin,
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tornado\gen.py", line 209, in wrapper
    yielded = next(result)
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\ipykernel\ipkernel.py", line 300, in do_execute
    res = shell.run_cell(code, store_history=store_history, silent=silent)
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\ipykernel\zmqshell.py", line 536, in run_cell
    return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\IPython\core\interactiveshell.py", line 2858, in run_cell
    raw_cell, store_history, silent, shell_futures)
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\IPython\core\interactiveshell.py", line 2886, in _run_cell
    return runner(coro)
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\IPython\core\async_helpers.py", line 68, in _pseudo_sync_runner
    coro.send(None)
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\IPython\core\interactiveshell.py", line 3063, in run_cell_async
    interactivity=interactivity, compiler=compiler, result=result)
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\IPython\core\interactiveshell.py", line 3254, in run_ast_nodes
    if (await self.run_code(code, result,  async_=asy)):
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\IPython\core\interactiveshell.py", line 3331, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-3-e4fbc8c0fd9a>", line 37, in <module>
    vgg_for_style.build(style)
  File "<ipython-input-1-8c661ffe24a7>", line 86, in build
    self.conv1_1 = self.conv_layer(x_bgr, 'conv1_1')
  File "<ipython-input-1-8c661ffe24a7>", line 31, in conv_layer
    h = tf.nn.conv2d(x, conv_w, [1,1,1,1], padding='SAME')
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tensorflow\python\ops\nn_ops.py", line 1953, in conv2d
    name=name)
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tensorflow\python\ops\gen_nn_ops.py", line 1161, in conv2d
    data_format=data_format, dilations=dilations, name=name)
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
    op_def=op_def)
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tensorflow\python\framework\ops.py", line 3616, in create_op
    op_def=op_def)
  File "c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tensorflow\python\framework\ops.py", line 2005, in __init__
    self._traceback = tf_stack.extract_stack()


然后在之前第三个模块运行时,出现了如下的警告:

building model ...
building model finished:    0s
building model ...
building model finished:    0s
building model ...
building model finished:    0s
WARNING:tensorflow:From c:\users\lanjun\.conda\envs\tensorflow1_14_0\lib\site-packages\tensorflow\python\ops\math_grad.py:1205: add_dispatch_support.<locals>.wrapper (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where

我把故宫的图片换成了一个自己的224224的图片,因为那个故宫图片不是224224的,现在运行报这个错误,请问老师是哪里的问题呢?

正在回答 回答被采纳积分+3

1回答

提问者 战战的坚果 2020-04-07 15:40:51

已解决


0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号