1
votes

Laptop specs : OS : Mac OS Mojave Python : 3.7

while fitting a rnn model i get the following error :

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

> [[node cu_dnnlstm/CudnnRNN (defined at <ipython-input-15->580eb6f63222>:3)  = CudnnRNN[T=DT_FLOAT, direction="unidirectional", >dropout=0, input_mode="linear_input", is_training=true, rnn_mode="lstm", >seed=0, seed2=0](cu_dnnlstm/transpose, cu_dnnlstm/ExpandDims, >cu_dnnlstm/ExpandDims_1, cu_dnnlstm/concat)]]

Caused by op 'cu_dnnlstm/CudnnRNN', defined at: File "/anaconda3/lib/python3.7/runpy.py", line 193, in >_run_module_as_main "main", mod_spec) File "/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py", >line 16, in app.launch_new_instance() File "/anaconda3/lib/python3.7/site->packages/traitlets/config/application.py", line 658, in launch_instance app.start() File "/anaconda3/lib/python3.7/site-packages/ipykernel/kernelapp.py", >line 497, in start self.io_loop.start() File "/anaconda3/lib/python3.7/site->packages/tornado/platform/asyncio.py", line 132, in start self.asyncio_loop.run_forever() File "/anaconda3/lib/python3.7/asyncio/base_events.py", line 523, in >run_forever self._run_once() File "/anaconda3/lib/python3.7/asyncio/base_events.py", line 1758, in >_run_once handle._run() File "/anaconda3/lib/python3.7/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/anaconda3/lib/python3.7/site-packages/tornado/ioloop.py", line >758, in _run_callback ret = callback() File "/anaconda3/lib/python3.7/site-packages/tornado/stack_context.py", >line 300, in null_wrapper return fn(*args, **kwargs) File "/anaconda3/lib/python3.7/site->packages/zmq/eventloop/zmqstream.py", line 536, in self.io_loop.add_callback(lambda : self._handle_events(self.socket, 0)) File "/anaconda3/lib/python3.7/site- >packages/zmq/eventloop/zmqstream.py", line 450, in _handle_events self._handle_recv() File "/anaconda3/lib/python3.7/site->packages/zmq/eventloop/zmqstream.py", line 480, in _handle_recv self._run_callback(callback, msg) File "/anaconda3/lib/python3.7/site->packages/zmq/eventloop/zmqstream.py", line 432, in _run_callback callback(*args, **kwargs) File "/anaconda3/lib/python3.7/site-packages/tornado/stack_context.py", line 300, in null_wrapper return fn(*args, **kwargs) File "/anaconda3/lib/python3.7/site-packages/ipykernel/kernelbase.py", line 283, in dispatcher return self.dispatch_shell(stream, msg) File "/anaconda3/lib/python3.7/site-packages/ipykernel/kernelbase.py", line 233, in dispatch_shell handler(stream, idents, msg) File "/anaconda3/lib/python3.7/site-packages/ipykernel/kernelbase.py", line 399, in execute_request user_expressions, allow_stdin) File "/anaconda3/lib/python3.7/site-packages/ipykernel/ipkernel.py", line 208, in do_execute res = shell.run_cell(code, store_history=store_history, silent=silent) File "/anaconda3/lib/python3.7/site-packages/ipykernel/zmqshell.py", line 537, in run_cell return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs) File "/anaconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 2662, in run_cell raw_cell, store_history, silent, shell_futures) File "/anaconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 2785, in _run_cell interactivity=interactivity, compiler=compiler, result=result) File "/anaconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 2901, in run_ast_nodes if self.run_code(code, result): File "/anaconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 2961, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 3, in model.add(CuDNNLSTM(128,input_shape = (x_train.shape[1:]) ,return_sequences=True)) File "/anaconda3/lib/python3.7/site-packages/tensorflow/python/training/checkpointable/base.py", line 474, in _method_wrapper method(self, *args, **kwargs) File "/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/sequential.py", line 159, in add layer(x) File "/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/layers/recurrent.py", line 619, in call return super(RNN, self).call(inputs, **kwargs) File "/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 757, in call outputs = self.call(inputs, *args, **kwargs) File "/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/layers/cudnn_recurrent.py", line 109, in call output, states = self._process_batch(inputs, initial_state) File "/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/layers/cudnn_recurrent.py", line 493, in _process_batch is_training=True) File "/anaconda3/lib/python3.7/site-packages/tensorflow/python/ops/gen_cudnn_rnn_ops.py", line 116, in cudnn_rnn is_training=is_training, name=name) File "/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/anaconda3/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func return func(*args, **kwargs) File "/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 3274, in create_op op_def=op_def) File "/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 1770, in init self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): No OpKernel was registered to support Op 'CudnnRNN' with these attrs. Registered devices: [CPU], Registered kernels:

 [[node cu_dnnlstm/CudnnRNN (defined at <ipython-input-15-580eb6f63222>:3)  = CudnnRNN[T=DT_FLOAT, direction="unidirectional", dropout=0, input_mode="linear_input", is_training=true, rnn_mode="lstm", seed=0, seed2=0](cu_dnnlstm/transpose, cu_dnnlstm/ExpandDims, cu_dnnlstm/ExpandDims_1, cu_dnnlstm/concat)]]
2
Looking at the error, it seems it is trying to run with the GPU which you have not configured to run DL models.GRoutar

2 Answers

1
votes

You are running a CuDNN-based layer (most likely CuDNNLSTM) on the CPU, which won't work because the CuDNN implementation is only available for NVIDIA GPUs with CUDA.

Solution would be to replae the CuDNNLSTM layer with a normal LSTM layer.

0
votes

Are you sure that your Mac does have a Nvidia GPU? Besides, it supports CuDNN?