[tensor] revert local view back (#1178)

This commit is contained in:
Jiarui Fang
2022-06-27 18:38:34 +08:00
committed by GitHub
parent 0dd4e2bbfb
commit 1b657f9ce1
4 changed files with 10 additions and 20 deletions

View File

@@ -67,14 +67,14 @@ def _run_view(world_size):
TensorSpec(distspec.shard(process_group=gpc.get_group(ParallelMode.DATA), dims=[0],
num_partitions=[world_size])))
assert t.size()[0] == 4 * world_size
assert t.size(1) == 5
assert t.size() == torch.Size([4 * world_size, 5])
assert t.size_global()[0] == 4 * world_size
assert t.size_global(1) == 5
assert t.size_global() == torch.Size([4 * world_size, 5])
t.view_base(4 * 5)
t.view_local(4 * 5)
assert t.tensor_spec.dist_spec.placement.value == 's'
t = t.view(4 * 5 * world_size)
t = t.view_global(4 * 5 * world_size)
assert t.tensor_spec.dist_spec.placement.value == 'r'
assert t.shape == torch.Size([4 * 5 * world_size])