# Error with LSTM Layer on MPS

**URL:** <https://discuss.pytorch.org/t/error-with-lstm-layer-on-mps/189031>\
**Category:** mps\
**Created:** [September 27, 2023, 8:11am UTC](https://discuss.pytorch.org/t/error-with-lstm-layer-on-mps/189031 "2023-09-27T08:11:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![boguh](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/b/9de053/32.png) [@boguh](https://discuss.pytorch.org/u/boguh)\
**Post date:** [September 27, 2023, 8:11am UTC](https://discuss.pytorch.org/t/error-with-lstm-layer-on-mps/189031/1 "2023-09-27T08:11:06Z")

</div>

Hi,

I am trying to implement an LSTM network and set it so calculations are on the GPU with .to(device) but I keep getting the same error:

> NotImplementedError: The operator ‘aten::mkldnn\_rnn\_layer’ is not currently implemented for the MPS device. If you want this op to be added in priority during the prototype phase of this feature, please comment on [General MPS op coverage tracking issue · Issue #77764 · pytorch/pytorch · GitHub](https://github.com/pytorch/pytorch/issues/77764). As a temporary fix, you can set the environment variable `PYTORCH_ENABLE_MPS_FALLBACK=1` to use the CPU as a fallback for this op. WARNING: this will be slower than running natively on MPS.

I thought that the ability to use MPS with an AMD GPU was already implemented? Does anyone know the issue?

Here is the code that produced the error:

```auto
x = torch.ones(1,1,10)

device = torch.device('mps')
x.to(device)

lstm_layer = torch.nn.LSTM(
    input_size=10,
    hidden_size=10,
    num_layers=1,
    batch_first=True
)

lstm_layer.to(device)

out, (h, c) = lstm_layer(x)

```

**Versions:**

- MacOS Ventura 13.4.1, Intel processor
- AMD Radeon Pro 5300M
- pytorch 2.0.1, installed using anaconda
