multiple docs

This commit is contained in:
Leonid Vlasenkov
2017-06-19 22:47:18 +03:00
committed by Soumith Chintala
parent 82ef292f00
commit 6ee6b4980b
2 changed files with 425 additions and 404 deletions

View File

@ -15,26 +15,26 @@ storage_classes = [
]
def add_docstr_all(classes, method, docstr):
for cls_name in classes:
def add_docstr_all(method, docstr):
for cls_name in storage_classes:
cls = getattr(torch._C, cls_name)
add_docstr(getattr(cls, method),
docstr.format(
cls_name.replace('Base', ''),
cls_name.replace('StorageBase', '')))
try:
add_docstr(getattr(cls, method), docstr)
except AttributeError:
pass
add_docstr_all(storage_classes, 'from_file',
add_docstr_all('from_file',
"""
from_file(filename, shared=False, size=0) -> {0}
from_file(filename, shared=False, size=0) -> Storage
If shared is True then memory is shared between all processes. All changes are
written to the file. If shared is False then the changes on the storage do not
affect the file.
Size is the number of elements in the storage. If shared is False then the file
must contain at least `size * sizeof({1})` bytes. If shared is True the file
will be created if needed.
must contain at least `size * sizeof(Type)` bytes (`Type` is the type of storage).
If shared is True the file will be created if needed.
Args:
filename (str): file name to map

File diff suppressed because it is too large Load Diff