mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 00:20:18 +01:00
enable type check common_distributed (#44821)
Summary: Enabled type checking in common_distributed by using tensors of ints Pull Request resolved: https://github.com/pytorch/pytorch/pull/44821 Test Plan: Run python test/test_type_hints.py, errors are no longer ingnored by mypy.ini Reviewed By: walterddr Differential Revision: D23747466 Pulled By: alanadakotashine fbshipit-source-id: 820fd502d7ff715728470fbef0be90ae7f128dd6
This commit is contained in:
parent
e48201c5cf
commit
ba6534ae2b
3
mypy.ini
3
mypy.ini
|
|
@ -65,9 +65,6 @@ ignore_errors = True
|
|||
[mypy-torch.testing._internal.common_quantized.*]
|
||||
ignore_errors = True
|
||||
|
||||
[mypy-torch.testing._internal.common_distributed.*]
|
||||
ignore_errors = True
|
||||
|
||||
[mypy-torch.testing._internal.jit_utils.*]
|
||||
ignore_errors = True
|
||||
|
||||
|
|
|
|||
|
|
@ -161,10 +161,10 @@ def simple_sparse_reduce_tests(rank, world_size, num_inputs=1):
|
|||
# First sparse dimension is [0..rank].
|
||||
# Subsequent dimensions are always 0, so we know there is
|
||||
# a non-empty intersection between any two sparse tensors.
|
||||
indices = [range(rank + 1)]
|
||||
indices = torch.reshape(torch.arange(rank + 1), (1, rank + 1))
|
||||
shape = [world_size] + [2 for _ in range(dense_dims)]
|
||||
for _ in range(sparse_dims - 1):
|
||||
indices.append([0] * (rank + 1))
|
||||
indices = torch.cat((indices, torch.zeros(1, rank + 1)))
|
||||
shape.append(world_size)
|
||||
values = torch.ones([rank + 1] + [2 for _ in range(dense_dims)])
|
||||
return torch.sparse_coo_tensor(indices, values, shape)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user