Fake Tensor error 'lengths' argument should be a 1D CPU int64 tensor, but got 1D meta Long tensor
Labels: triaged, oncall: pt2, module: fakeTensor, mlperf

### 🐛 Describe the bug

Problem found here https://github.com/mlcommons/algorithmic-efficiency/issues/498

```python
import torch
import torch.nn as nn

class BatchRNN(nn.Module):

  def __init__(self):
    super().__init__()

  def forward(self, inputs, input_paddings):
    batch_size, seq_len, _ = inputs.size()
    lengths = torch.randint(1, seq_len + 1, (batch_size,))
    packed_inputs = torch.nn.utils.rnn.pack_padded_sequence(
        inputs, lengths, batch_first=True, enforce_sorted=False)

    return packed_inputs

model = BatchRNN()
model(torch.randn(1, 32, 32), torch.randn(1, 32, 32))
model = torch.compile(model) 
model(torch.randn(1, 32, 32), torch.randn(1, 32, 32))

```

### Error logs

```
(sam) ubuntu@ip-172-31-9-217:~$ python rnn.py 
Traceback (most recent call last):
  File "/home/ubuntu/rnn.py", line 23, in <module>
    model(torch.randn(1, 32, 32), torch.randn(1, 32, 32))
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 333, in _fn
    return fn(*args, **kwargs)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py", line 493, in catch_errors
    return callback(frame, cache_size, hooks, frame_state)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 605, in _convert_frame
    result = inner_convert(frame, cache_size, hooks, frame_state)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 132, in _fn
    return fn(*args, **kwargs)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 370, in _convert_frame_assert
    return _compile(
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 536, in _compile
    guarded_code = compile_inner(code, one_graph, hooks, transform)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 180, in time_wrapper
    r = func(*args, **kwargs)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 447, in compile_inner
    out_code = transform_code_object(code, transform)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/bytecode_transformation.py", line 1028, in transform_code_object
    transformations(instructions, code_options)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 425, in transform
    tracer.run()
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 2071, in run
    super().run()
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 724, in run
    and self.step()
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 688, in step
    getattr(self, inst.opname)(inst)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 392, in wrapper
    return inner_fn(self, inst)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 1167, in CALL_FUNCTION_KW
    self.call_function(fn, args, kwargs)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 562, in call_function
    self.push(fn.call_function(self, args, kwargs))
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/variables/torch.py", line 716, in call_function
    tensor_variable = wrap_fx_proxy(
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/variables/builder.py", line 1163, in wrap_fx_proxy
    return wrap_fx_proxy_cls(
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/variables/builder.py", line 1237, in wrap_fx_proxy_cls
    example_value = get_fake_value(proxy.node, tx)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 1351, in get_fake_value
    raise TorchRuntimeError(str(e)).with_traceback(e.__traceback__) from None
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 1319, in get_fake_value
    return wrap_fake_exception(
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 898, in wrap_fake_exception
    return fn()
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 1320, in <lambda>
    lambda: run_node(tx.output, node, args, kwargs, nnmodule)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 1385, in run_node
    raise RuntimeError(fn_str + str(e)).with_traceback(e.__traceback__) from e
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_dynamo/utils.py", line 1372, in run_node
    return node.target(*args, **kwargs)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/nn/utils/rnn.py", line 264, in pack_padded_sequence
    _VF._pack_padded_sequence(input, lengths, batch_first)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/utils/_stats.py", line 20, in wrapper
    return fn(*args, **kwargs)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_subclasses/fake_tensor.py", line 1233, in __torch_dispatch__
    return self.dispatch(func, types, args, kwargs)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_subclasses/fake_tensor.py", line 1523, in dispatch
    r = func(*args, **kwargs)
  File "/opt/conda/envs/sam/lib/python3.10/site-packages/torch/_ops.py", line 435, in __call__
    return self._op(*args, **kwargs or {})
torch._dynamo.exc.TorchRuntimeError: Failed running call_function <function pack_padded_sequence at 0x7ff611d61900>(*(FakeTensor(..., size=(1, 32, 32)), FakeTensor(..., size=(1,), dtype=torch.int64)), **{'batch_first': True, 'enforce_sorted': False}):
'lengths' argument should be a 1D CPU int64 tensor, but got 1D meta Long tensor

from user code:
   File "/home/ubuntu/rnn.py", line 15, in forward
    packed_inputs = torch.nn.utils.rnn.pack_padded_sequence(

Set TORCH_LOGS="+dynamo" and TORCHDYNAMO_VERBOSE=1 for more information


You can suppress this exception and fall back to eager by setting:
    import torch._dynamo
    torch._dynamo.config.suppress_errors = True
```

### Minified repro

_No response_

### Versions

`torch ==2.1.0.dev20230814+cu121`

cc @ezyang @wconstab @bdhirsh @anijain2305