Do not incorrectly chain each of the strings as iterables (#160709)

Signed-off-by: Edward Yang <ezyang@meta.com>

Pull Request resolved: https://github.com/pytorch/pytorch/pull/160709
Approved by: https://github.com/Skylion007, https://github.com/fduwjj
This commit is contained in:
Edward Yang
2025-08-15 00:06:38 -04:00
committed by PyTorch MergeBot
parent 387fe847ab
commit 838f22c57d

View File

@ -188,7 +188,7 @@ else:
# Check whether the mesh_dim_name for flattened mesh is valid.
self.flatten_name_to_root_dims.setdefault(root_mesh, {})
invalid_dim_names = chain(
*list(not_none(root_mesh.mesh_dim_names)),
list(not_none(root_mesh.mesh_dim_names)),
*self.flatten_name_to_root_dims[root_mesh].keys(),
)
if mesh_dim_name in invalid_dim_names: