Skip to content

Commit 34fa5e0

Browse files
ronrestsoumith
authored andcommitted
Update docstrings for testing object type
Add docstring for `is_storage()` and `is_tensor()`
1 parent 712686c commit 34fa5e0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

torch/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,20 @@ def typename(o):
7575

7676

7777
def is_tensor(obj):
78+
r"""Returns True if `obj` is a pytorch tensor.
79+
80+
Args:
81+
obj (Object): Object to test
82+
"""
7883
return obj.__class__ in _tensor_classes
7984

8085

8186
def is_storage(obj):
87+
r"""Returns True if `obj` is a pytorch storage object.
88+
89+
Args:
90+
obj (Object): Object to test
91+
"""
8292
return obj.__class__ in _storage_classes
8393

8494

0 commit comments

Comments
 (0)