Repository: pytorch
Issue: [JIT legacy executor] device propagation regression
Labels: oncall: jit,triaged

## 🐛 Bug

PR #33705 introduces regression on shape propagation.
`rand_like` does not propagate correct device from input to output any more.I'm observing gpu tensor input with output marked as cpu tensor.

## To Reproduce

```
import torch
torch._C._jit_set_profiling_executor(False)
torch._C._jit_set_profiling_mode(False)

def fn(x : torch.Tensor):                  
    out = torch.nn.functional.dropout(x, p=0.1, training=True)  
    return out

fn_jit = torch.jit.script(fn)
x = torch.randn(20, 64, device="cuda", dtype=torch.float32).requires_grad_()
print(fn_jit.graph_for(x))
```

After the commit, output becomes:
```
graph(%x.1 : Float(*, *)):
  %17 : Float(*, *) = prim::DifferentiableGraph_0(%x.1)
  return (%17)
with prim::DifferentiableGraph_0 = graph(%0 : Float(*, *)):
  %51 : float = prim::Constant[value=1.1111111111111112]()
  %50 : float = prim::Constant[value=0.90000000000000002]()
  %49 : bool = prim::Constant[value=1]()
  %7 : int = prim::Constant[value=1]() # <string>:103:64
  %6 : float = prim::Constant[value=1.]() # <string>:100:18
  %5 : None = prim::Constant()
  %15 : Double(*, *) = aten::rand_like(%0, %5, %5, %5, %5, %7) # <string>:103:27
  %mask.1 : Bool(*, *) = aten::lt(%15, %50) # <string>:103:27
  %17 : Float(*, *) = aten::type_as(%mask.1, %0) # <string>:104:26
  %18 : Float(*, *) = aten::mul(%17, %0) # <string>:104:26
  %res.1 : Float(*, *) = aten::mul(%18, %51) # <string>:104:26
  return (%res.1, %5, %6, %7, %49, %50, %mask.1, %50)
```

## Expected behavior

Previously, dropout node could be fused as:
```
graph(%x.1 : Float(*, *)):
  %17 : Float(*, *) = prim::DifferentiableGraph_0(%x.1)
  return (%17)
with prim::DifferentiableGraph_0 = graph(%0 : Float(*, *)):
  %50 : float = prim::Constant[value=0.90000000000000002]()
  %49 : bool = prim::Constant[value=1]()
  %7 : int = prim::Constant[value=1]() # <string>:103:64
  %6 : float = prim::Constant[value=1.]() # <string>:100:18
  %5 : None = prim::Constant()
  %res.1 : Float(*, *), %mask.1 : Bool(*, *) = prim::FusionGroup_0(%0)
  return (%res.1, %5, %6, %7, %49, %50, %mask.1, %50)
with prim::FusionGroup_0 = graph(%4 : Float(*, *)):
  %1 : float = prim::Constant[value=1.1111111111111112]()
  %9 : float = prim::Constant[value=0.90000000000000002]()
  %11 : int = prim::Constant[value=1]() # <string>:103:64
  %12 : Float(*, *) = aten::rand_like(%4, %11) # <string>:103:27
  %mask.1 : Bool(*, *) = aten::lt(%12, %9) # <string>:103:27
  %7 : Float(*, *) = aten::type_as(%mask.1, %4) # <string>:104:26
  %5 : Float(*, *) = aten::mul(%7, %4) # <string>:104:26
  %res.1 : Float(*, *) = aten::mul(%5, %1) # <string>:104:26
  return (%res.1, %mask.1)
```

## Additional context

I have checked the `FuseGraph` code path and I'm seeing the device inconsistency between inputs and outputs tensors for `rand_like` node. I'm suspecting it's related to changes in `shape_analysis.cpp` in: https://github.com/pytorch/pytorch/pull/33705/files

FYI: Repro was running on commit: ad769d74d9168fffc78c7dd64d8b3ede6548460f

And expected behavior was running on the commit right before it: b98bce8cd4730af1a5c3852f99e7754e954a6563

cc @suo