Add layer_idx to CrossAttention of GPT2 model
When I tried `EncoderDecoderModel` with GPT2 model + `_upcast_and_reordered_attn`, cross attention layer did not have `layer_idx`, so the following error occured.

```
t2.py", line 240, in _upcast_and_reordered_attn
    scale_factor /= float(self.layer_idx + 1)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
```

cc @patrickvonplaten @LysandreJik

_The documentation is not available anymore as the PR was closed or merged._<|||||>Looks good, thanks!

Once being approved by patrickvonplaten/LysandreJik/sgugger , could you also apply the same change to `modeling_imagegpt.py`, please:

https://github.com/huggingface/transformers/blob/2c2a31ffbcfe03339b1721348781aac4fc05bc5e/src/transformers/models/imagegpt/modeling_imagegpt.py#L426<|||||>@ydshieh Sure. <|||||>Thanks!