!28695 Fix some API doc errors in minddata

Merge pull request !28695 from xiaotianci/fix_api_docs
This commit is contained in:
i-robot 2022-01-07 09:51:07 +00:00 committed by Gitee
commit 55f1ad1995
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 19 additions and 10 deletions

View File

@ -1,4 +1,4 @@
# Copyright 2021 Huawei Technologies Co., Ltd
# Copyright 2021-2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -194,7 +194,7 @@ class BandpassBiquad(AudioTensorOperation):
class BandrejectBiquad(AudioTensorOperation):
"""
Design two-pole band filter for audio waveform of dimension of (..., time).
Design two-pole band-reject filter for audio waveform of dimension of (..., time).
Args:
sample_rate (int): sampling rate of the waveform, e.g. 44100 (Hz), the value can't be zero.

View File

@ -1,4 +1,4 @@
# Copyright 2019-2021 Huawei Technologies Co., Ltd
# Copyright 2019-2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -497,6 +497,8 @@ def get_enable_shared_mem():
"""
Get the default state of shared mem enabled variable.
Note:
`get_enable_shared_mem` is not supported on Windows and MacOS platforms yet.
Returns:
bool, the state of shared mem enabled variable (default=True).
@ -505,9 +507,9 @@ def get_enable_shared_mem():
>>> # Get the flag of shared memory feature.
>>> shared_mem_flag = ds.config.get_enable_shared_mem()
"""
# For windows and macos we forbid shared mem function temporarily
# For Windows and MacOS we forbid shared mem function temporarily
if platform.system().lower() in {"windows", "darwin"}:
logger.warning("For windows and macos we forbid shared mem function temporarily.")
logger.warning("For Windows and MacOS we forbid shared mem function temporarily.")
return False
return _config.get_enable_shared_mem()
@ -517,6 +519,9 @@ def set_enable_shared_mem(enable):
Set the default state of shared memory flag. If shared_mem_enable is True, will use shared memory queues
to pass data to processes that are created for operators that set python_multiprocessing=True.
Note:
`set_enable_shared_mem` is not supported on Windows and MacOS platforms yet.
Args:
enable (bool): Whether to use shared memory in operators when python_multiprocessing=True.
@ -527,12 +532,16 @@ def set_enable_shared_mem(enable):
>>> # Enable shared memory feature to improve the performance of Python multiprocessing.
>>> ds.config.set_enable_shared_mem(True)
"""
# For Windows and MacOS we forbid shared mem function temporarily
if platform.system().lower() in {"windows", "darwin"}:
logger.warning("For Windows and MacOS we forbid shared mem function temporarily.")
return
if not isinstance(enable, bool):
raise TypeError("enable must be of type bool.")
if enable:
logger.warning("The shared memory is on, multiprocessing performance will be improved. "
"Note: the required shared memory can't exceeds 80% of the available shared memory. "
"You can reduce max_rowsize or reduce num_parallel_workers to reduce shared memory usage.")
"Note: the required shared memory can't exceeds 80% of the available shared memory.")
_config.set_enable_shared_mem(enable)

View File

@ -1,4 +1,4 @@
# Copyright 2019-2021 Huawei Technologies Co., Ltd
# Copyright 2019-2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -4310,7 +4310,7 @@ class PennTreebankDataset(SourceDataset, TextBaseDataset):
(default=None, which means no cache is used).
Examples:
>>> penn_treebank_dataset_dir = "path/to/penn_treebank_dataset_directory"
>>> penn_treebank_dataset_dir = "/path/to/penn_treebank_dataset_directory"
>>> dataset = ds.PennTreebankDataset(dataset_dir=penn_treebank_dataset_dir, usage='all')
About PennTreebank dataset:

View File

@ -1,4 +1,4 @@
# Copyright 2019-2021 Huawei Technologies Co., Ltd
# Copyright 2019-2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.