tensorflow tutorialでcycle ganのtutorialをやっています.
途中のコードは省きますが次を実行しようとしたらその下のエラーが出ました.
python
1 2OUTPUT_CHANNELS = 3 3 4generator_g = pix2pix.unet_generator(OUTPUT_CHANNELS, norm_type='instancenorm') 5generator_f = pix2pix.unet_generator(OUTPUT_CHANNELS, norm_type='instancenorm') 6 7discriminator_x = pix2pix.discriminator(norm_type='instancenorm', target=False) 8discriminator_y = pix2pix.discriminator(norm_type='instancenorm', target=False) 9to_zebra = generator_g(sample_horse) 10to_horse = generator_f(sample_zebra) 11plt.figure(figsize=(8, 8)) 12contrast = 8 13 14imgs = [sample_horse, to_zebra, sample_zebra, to_horse] 15title = ['Horse', 'To Zebra', 'Zebra', 'To Horse'] 16 17for i in range(len(imgs)): 18 plt.subplot(2, 2, i+1) 19 plt.title(title[i]) 20 if i % 2 == 0: 21 plt.imshow(imgs[i][0] * 0.5 + 0.5) 22 else: 23 plt.imshow(imgs[i][0] * 0.5 * contrast + 0.5) 24plt.show()
python
1UnknownError: 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. [Op:Conv2D]
以前の質問も確認して,バージョンもあっているかと思うのですが,原因が分かりません.
環境
windows10
tensorflow-gpu 2.3.0
CUDA 10.1
cudnn 7.6.5
tensorflow-gpuはpipで入れています.
python
1from tensorflow.python.client import device_lib 2device_lib.list_local_devices()
でGPUを認識しているのですが,
python
1conda list 2 3absl-py 0.10.0 pypi_0 pypi 4argon2-cffi 20.1.0 py37he774522_1 5astunparse 1.6.3 pypi_0 pypi 6async_generator 1.10 py37h28b3542_0 7attrs 20.3.0 pyhd3eb1b0_0 8backcall 0.2.0 py_0 9bleach 3.2.1 py_0 10ca-certificates 2020.12.8 haa95532_0 11cachetools 4.2.0 pypi_0 pypi 12certifi 2020.12.5 py37haa95532_0 13cffi 1.14.4 py37hcd4344a_0 14chardet 4.0.0 pypi_0 pypi 15colorama 0.4.4 pyhd3eb1b0_0 16cycler 0.10.0 pypi_0 pypi 17decorator 4.4.2 py_0 18defusedxml 0.6.0 py_0 19dill 0.3.3 pypi_0 pypi 20entrypoints 0.3 py37_0 21future 0.18.2 pypi_0 pypi 22 23sqlite 3.33.0 h2a8f88b_0 24tensorboard 2.4.0 pypi_0 pypi 25tensorboard-plugin-wit 1.7.0 pypi_0 pypi 26tensorflow-datasets 4.1.0 pypi_0 pypi 27tensorflow-gpu 2.3.0 pypi_0 pypi 28tensorflow-gpu-estimator 2.3.0 pypi_0 pypi 29tensorflow-hub 0.10.0 pypi_0 pypi 30tensorflow-metadata 0.26.0 pypi_0 pypi 31
でCUDA,cudnnが出てきません.
PATHは以下のように通してます.
原因が分かりません.ご教授よろしくお願いいたします.
追記
「try looking to see if a warning log message was printed above.」
と書いてありますけど、それより上には関係してそうなメッセージは何か書かれてませんか?
以下がエラーメッセージでした.特に問題の原因となるような言葉は書いてなさそうです..
python
1UnknownError Traceback (most recent call last) 2<ipython-input-15-284f1d86293d> in <module> 3 6 discriminator_x = pix2pix.discriminator(norm_type='instancenorm', target=False) 4 7 discriminator_y = pix2pix.discriminator(norm_type='instancenorm', target=False) 5----> 8 to_zebra = generator_g(sample_horse) 6 9 to_horse = generator_f(sample_zebra) 7 10 plt.figure(figsize=(8, 8)) 8 9~\anaconda3\envs\DEP3\lib\site-packages\tensorflow\python\keras\engine\base_layer.py in __call__(self, *args, **kwargs) 10 983 11 984 with ops.enable_auto_cast_variables(self._compute_dtype_object): 12--> 985 outputs = call_fn(inputs, *args, **kwargs) 13 986 14 987 if self._activity_regularizer: 15 16~\anaconda3\envs\DEP3\lib\site-packages\tensorflow\python\keras\engine\functional.py in call(self, inputs, training, mask) 17 384 """ 18 385 return self._run_internal_graph( 19--> 386 inputs, training=training, mask=mask) 20 387 21 388 def compute_output_shape(self, input_shape): 22 23~\anaconda3\envs\DEP3\lib\site-packages\tensorflow\python\keras\engine\functional.py in _run_internal_graph(self, inputs, training, mask) 24 506 25 507 args, kwargs = node.map_arguments(tensor_dict) 26--> 508 outputs = node.layer(*args, **kwargs) 27 509 28 510 # Update tensor_dict. 29 30~\anaconda3\envs\DEP3\lib\site-packages\tensorflow\python\keras\engine\base_layer.py in __call__(self, *args, **kwargs) 31 983 32 984 with ops.enable_auto_cast_variables(self._compute_dtype_object): 33--> 985 outputs = call_fn(inputs, *args, **kwargs) 34 986 35 987 if self._activity_regularizer: 36 37~\anaconda3\envs\DEP3\lib\site-packages\tensorflow\python\keras\engine\sequential.py in call(self, inputs, training, mask) 38 370 if not self.built: 39 371 self._init_graph_network(self.inputs, self.outputs) 40--> 372 return super(Sequential, self).call(inputs, training=training, mask=mask) 41 373 42 374 outputs = inputs # handle the corner case where self.layers is empty 43 44~\anaconda3\envs\DEP3\lib\site-packages\tensorflow\python\keras\engine\functional.py in call(self, inputs, training, mask) 45 384 """ 46 385 return self._run_internal_graph( 47--> 386 inputs, training=training, mask=mask) 48 387 49 388 def compute_output_shape(self, input_shape): 50 51~\anaconda3\envs\DEP3\lib\site-packages\tensorflow\python\keras\engine\functional.py in _run_internal_graph(self, inputs, training, mask) 52 506 53 507 args, kwargs = node.map_arguments(tensor_dict) 54--> 508 outputs = node.layer(*args, **kwargs) 55 509 56 510 # Update tensor_dict. 57 58~\anaconda3\envs\DEP3\lib\site-packages\tensorflow\python\keras\engine\base_layer.py in __call__(self, *args, **kwargs) 59 983 60 984 with ops.enable_auto_cast_variables(self._compute_dtype_object): 61--> 985 outputs = call_fn(inputs, *args, **kwargs) 62 986 63 987 if self._activity_regularizer: 64 65~\anaconda3\envs\DEP3\lib\site-packages\tensorflow\python\keras\layers\convolutional.py in call(self, inputs) 66 245 inputs = array_ops.pad(inputs, self._compute_causal_padding(inputs)) 67 246 68--> 247 outputs = self._convolution_op(inputs, self.kernel) 69 248 70 249 if self.use_bias: 71 72~\anaconda3\envs\DEP3\lib\site-packages\tensorflow\python\util\dispatch.py in wrapper(*args, **kwargs) 73 199 """Call target, and fall back on dispatchers if there is a TypeError.""" 74 200 try: 75--> 201 return target(*args, **kwargs) 76 202 except (TypeError, ValueError): 77 203 # Note: convert_to_eager_tensor currently raises a ValueError, not a 78 79~\anaconda3\envs\DEP3\lib\site-packages\tensorflow\python\ops\nn_ops.py in convolution_v2(input, filters, strides, padding, data_format, dilations, name) 80 1016 data_format=data_format, 81 1017 dilations=dilations, 82-> 1018 name=name) 83 1019 84 1020 85 86~\anaconda3\envs\DEP3\lib\site-packages\tensorflow\python\ops\nn_ops.py in convolution_internal(input, filters, strides, padding, data_format, dilations, name, call_from_convolution, num_spatial_dims) 87 1146 data_format=data_format, 88 1147 dilations=dilations, 89-> 1148 name=name) 90 1149 else: 91 1150 if channel_index == 1: 92 93~\anaconda3\envs\DEP3\lib\site-packages\tensorflow\python\ops\nn_ops.py in _conv2d_expanded_batch(input, filters, strides, padding, data_format, dilations, name) 94 2590 data_format=data_format, 95 2591 dilations=dilations, 96-> 2592 name=name) 97 2593 return squeeze_batch_dims( 98 2594 input, 99 100~\anaconda3\envs\DEP3\lib\site-packages\tensorflow\python\ops\gen_nn_ops.py in conv2d(input, filter, strides, padding, use_cudnn_on_gpu, explicit_paddings, data_format, dilations, name) 101 936 return _result 102 937 except _core._NotOkStatusException as e: 103--> 938 _ops.raise_from_not_ok_status(e, name) 104 939 except _core._FallbackException: 105 940 pass 106 107~\anaconda3\envs\DEP3\lib\site-packages\tensorflow\python\framework\ops.py in raise_from_not_ok_status(e, name) 108 6841 message = e.message + (" name: " + name if name is not None else "") 109 6842 # pylint: disable=protected-access 110-> 6843 six.raise_from(core._status_to_exception(e.code, message), None) 111 6844 # pylint: enable=protected-access 112 6845 113 114~\anaconda3\envs\DEP3\lib\site-packages\six.py in raise_from(value, from_value) 115 116UnknownError: 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. [Op:Conv2D]
[https://teratail.com/questions/306602
](https://teratail.com/questions/306602)
の「Code2」をGPU有り環境で実行すると
上記のコードを実行したところ同じようなエラーが出ました...
python
1UnknownError: 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. 2 [[node sequential/conv2d/Relu (defined at <ipython-input-2-de4210406d90>:13) ]] [Op:__inference_train_function_853] 3 4Function call stack: 5train_function
追記
回答1件
あなたの回答
tips
プレビュー