Repository: pytorch
Issue: [DTensor][TP] 1-way TP raises index out of range
Labels: triaged,better-engineering,module: dtensor



```
import torch
import torch.nn as nn
import torch.distributed as dist
from torch.distributed._device_mesh import init_device_mesh
from torch.distributed.tensor.parallel import PairwiseParallel, parallelize_module

assert torch.cuda.device_count() >= 2

dp_size, tp_size = (2, 1)
global_mesh = init_device_mesh(
    "cuda", (dp_size, tp_size), mesh_dim_names=("dp", "tp")
)
dp_mesh = global_mesh["dp"]
tp_mesh = global_mesh["tp"]
model = nn.Sequential(nn.Linear(3, 12, device="cuda"), nn.Linear(12, 3, device="cuda"))
model = parallelize_module(
    model,
    device_mesh=tp_mesh,
    parallelize_plan=PairwiseParallel(),
)
inp = torch.randn((2, 3), device="cuda")
model(inp)
```

```
 torchrun --standalone --nproc-per-node 2 repro.py
```

```
Traceback (most recent call last):
  File "/data/users/andgu/distx/repro.py", line 22, in <module>
    model(inp)
  File "/data/users/andgu/pytorch/torch/nn/modules/module.py", line 1510, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/data/users/andgu/pytorch/torch/nn/modules/module.py", line 1519, in _call_impl
    return forward_call(*args, **kwargs)
  File "/data/users/andgu/pytorch/torch/nn/modules/container.py", line 217, in forward
    input = module(input)
  File "/data/users/andgu/pytorch/torch/nn/modules/module.py", line 1510, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/data/users/andgu/pytorch/torch/nn/modules/module.py", line 1560, in _call_impl
    result = forward_call(*args, **kwargs)
  File "/data/users/andgu/pytorch/torch/nn/modules/linear.py", line 120, in forward
    return F.linear(input, self.weight, self.bias)
  File "/data/users/andgu/pytorch/torch/distributed/_tensor/api.py", line 281, in __torch_dispatch__
    return DTensor._op_dispatcher.dispatch(
  File "/data/users/andgu/pytorch/torch/distributed/_tensor/dispatch.py", line 183, in dispatch
    self.sharding_propagator.propagate(op_info)
  File "/data/users/andgu/pytorch/torch/distributed/_tensor/sharding_prop.py", line 163, in propagate
    output_sharding = self.propagate_op_sharding(op_info.schema)
  File "/data/users/andgu/pytorch/torch/distributed/_tensor/sharding_prop.py", line 217, in propagate_op_sharding_non_cached
    op_strategy = self.op_strategy_funcs[op_schema.op](mesh, strategy_schema)
  File "/data/users/andgu/pytorch/torch/distributed/_tensor/ops/matrix_ops.py", line 120, in addmm_strategy
    return _addmm_like_strategy("mk,kn->mn", mesh, op_schema)
  File "/data/users/andgu/pytorch/torch/distributed/_tensor/ops/matrix_ops.py", line 74, in _addmm_like_strategy
    mm_strategy = gen_einsum_strategies(mm_equation, mesh)
  File "/data/users/andgu/pytorch/torch/distributed/_tensor/ops/basic_strategy.py", line 180, in gen_einsum_strategies
    strat = PlacementStrategy(output_spec=spec_list[0], input_specs=spec_list[1:])
IndexError: list index out of range
```

Should we skip when `len(spec_list) < 2`?
https://github.com/pytorch/pytorch/blob/9146ca6a079dfabea728bb3bbe6eb32516a3e275/torch/distributed/_tensor/ops/basic_strategy.py#L180


cc @wanchaol @XilunWu