Skip to content

Commit d0e7756

Browse files
aliafzalmeta-codesync[bot]
authored andcommitted
Fix Python Flake8 lint error E721. (#3402)
Summary: Pull Request resolved: #3402 Lint error E721 occurs when the type() function is used for type comparison instead of the more flexible isinstance(). The isinstance() function can handle subclasses as well. The codemod only replaces type() function with isinstance() function for type comparison and preserves the existing code functionality while improving code extensibility for future changes. Reviewed By: TroyGarden Differential Revision: D83559508 fbshipit-source-id: c54a8cb7c26c4d081e3fdd649c2e655afef22bc2
1 parent 8813a5f commit d0e7756

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torchrec/distributed/tests/test_dynamic_sharding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def are_sharded_ebc_modules_identical(
206206
val2 = getattr(module2, attr)
207207

208208
assert type(val1) is type(val2)
209-
if type(val1) is torch.Tensor:
209+
if isinstance(val1, torch.Tensor):
210210
torch.testing.assert_close(val1, val2)
211211
else:
212212
assert val1 == val2

0 commit comments

Comments
 (0)