forked from mindspore-Ecosystem/mindspore
!12128 fix function description for SummaryCollector and SummaryRecord
From: @jiang-shuqiang Reviewed-by: Signed-off-by:
This commit is contained in:
commit
33942ff060
|
@ -88,7 +88,10 @@ def _make_directory(path: str):
|
|||
else:
|
||||
logger.debug("The directory(%s) doesn't exist, will create it", path)
|
||||
try:
|
||||
os.makedirs(path, exist_ok=True, mode=0o700)
|
||||
permissions = os.R_OK | os.W_OK | os.X_OK
|
||||
os.umask(permissions << 3 | permissions)
|
||||
mode = permissions << 6
|
||||
os.makedirs(path, mode=mode, exist_ok=True)
|
||||
real_path = path
|
||||
except PermissionError as e:
|
||||
logger.error("No write permission on the directory(%r), error = %r", path, e)
|
||||
|
|
|
@ -130,13 +130,15 @@ class SummaryCollector(Callback):
|
|||
Default: None, which means no limit. For example, to write not larger than 4GB,
|
||||
specify `max_file_size=4 * 1024**3`.
|
||||
export_options (Union[None, dict]): Perform custom operations on the export data.
|
||||
Default: None, it means there is no export data.
|
||||
Default: None, it means that the data is not exported.
|
||||
Note that the size of export files is not limited by the max_file_size.
|
||||
You can customize the export data with a dictionary. For example, you can set {'tensor_format': 'npy'}
|
||||
to export tensor as npy file. The data that supports control is shown below.
|
||||
|
||||
- tensor_format (Union[str, None]): Customize the export tensor format.
|
||||
Default: None, it means there is no export tensor.
|
||||
- tensor_format (Union[str, None]): Customize the export tensor format. Supports ["npy", None].
|
||||
Default: None, it means that the tensor is not exported.
|
||||
|
||||
- npy: export tensor as npy file.
|
||||
|
||||
Raises:
|
||||
ValueError: If the parameter value is not expected.
|
||||
|
|
|
@ -36,7 +36,7 @@ _summary_lock = threading.Lock()
|
|||
# cache the summary data
|
||||
_summary_tensor_cache = {}
|
||||
_DEFAULT_EXPORT_OPTIONS = {
|
||||
'tensor_format': {'npy'},
|
||||
'tensor_format': {'npy', None},
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,7 +70,7 @@ def process_export_options(export_options):
|
|||
|
||||
for export_option, export_format in export_options.items():
|
||||
check_value_type('export_option', export_option, [str])
|
||||
check_value_type('export_format', export_format, [str])
|
||||
check_value_type('export_format', export_format, [str, type(None)])
|
||||
|
||||
unexpected_params = set(export_options) - set(_DEFAULT_EXPORT_OPTIONS)
|
||||
if unexpected_params:
|
||||
|
@ -115,13 +115,15 @@ class SummaryRecord:
|
|||
raise_exception (bool, optional): Sets whether to throw an exception when a RuntimeError or OSError exception
|
||||
occurs in recording data. Default: False, this means that error logs are printed and no exception is thrown.
|
||||
export_options (Union[None, dict]): Perform custom operations on the export data.
|
||||
Default: None, it means there is no export data.
|
||||
Default: None, it means that the data is not exported.
|
||||
Note that the size of export files is not limited by the max_file_size.
|
||||
You can customize the export data with a dictionary. For example, you can set {'tensor_format': 'npy'}
|
||||
to export tensor as npy file. The data that supports control is shown below.
|
||||
|
||||
- tensor_format (Union[str, None]): Customize the export tensor format.
|
||||
Default: None, it means there is no export tensor.
|
||||
- tensor_format (Union[str, None]): Customize the export tensor format. Supports ["npy", None].
|
||||
Default: None, it means that the tensor is not exported.
|
||||
|
||||
- npy: export tensor as npy file.
|
||||
|
||||
Raises:
|
||||
TypeError: If the parameter type is incorrect.
|
||||
|
|
Loading…
Reference in New Issue