未验证 提交 42aad304 编写于 作者: R Ren Wei (任卫) 提交者: GitHub

use the `required` instruction to determine if the environment fits the sample...

use the `required` instruction to determine if the environment fits the sample code's required. (#32766)

* add unittests

* add find_last_future_line_end

* extract_code_blocks_from_docstr and its testcases

* test_codeblock_before_examples_is_ignored

* sampcd_extract_to_file 拆为两步

* update the codeblock element's format

* code-block directive has no value options

* insert the CODES_INTERTED_INTO_FRONTEND

* using the new func insert_codes_into_codeblock

* get_test_capacity and is_required_match

* using the new funcitons in sampcd_extract_to_file

* add some comments and refactor functions

* using logger instead of all the print

* remote wlist

* collect summary info, and print them

* call get capacity

* update summary format

* print the apis that don't have sample codes.

* print the samples the consumed time more than 10s.

print time

* update unittest testcases

* solve ResourceWarning: unclosed file

* run tools test seperately

* python2 does not have nonlocal keyword, using dict variable instead

* remove unused import, rearrange a series of conditional statements.

* remove wlist.json and its check approval

* remove wlist.json and its check approval
上级 ed9e7723
...@@ -52,7 +52,7 @@ API_FILES=("CMakeLists.txt" ...@@ -52,7 +52,7 @@ API_FILES=("CMakeLists.txt"
"python/paddle/fluid/tests/unittests/white_list/op_threshold_white_list.py" "python/paddle/fluid/tests/unittests/white_list/op_threshold_white_list.py"
"python/paddle/fluid/tests/unittests/white_list/check_op_sequence_batch_1_input_white_list.py" "python/paddle/fluid/tests/unittests/white_list/check_op_sequence_batch_1_input_white_list.py"
"python/paddle/fluid/tests/unittests/white_list/no_grad_set_white_list.py" "python/paddle/fluid/tests/unittests/white_list/no_grad_set_white_list.py"
"tools/wlist.json" "tools/print_signatures.py"
"tools/sampcd_processor.py" "tools/sampcd_processor.py"
"paddle/scripts/paddle_build.bat" "paddle/scripts/paddle_build.bat"
"tools/windows/run_unittests.sh" "tools/windows/run_unittests.sh"
...@@ -80,11 +80,10 @@ function add_failed(){ ...@@ -80,11 +80,10 @@ function add_failed(){
echo_list="${echo_list[@]}$1" echo_list="${echo_list[@]}$1"
} }
function run_test_sampcd_processor() { function run_tools_test() {
CUR_PWD=$(pwd) CUR_PWD=$(pwd)
cd ${PADDLE_ROOT}/tools cd ${PADDLE_ROOT}/tools
python test_sampcd_processor.py python $1
python test_print_signatures.py
cd ${CUR_PWD} cd ${CUR_PWD}
} }
...@@ -141,12 +140,12 @@ for API_FILE in ${API_FILES[*]}; do ...@@ -141,12 +140,12 @@ for API_FILE in ${API_FILES[*]}; do
elif [ "${API_FILE}" == "python/paddle/fluid/tests/unittests/white_list/no_grad_set_white_list.py" ];then elif [ "${API_FILE}" == "python/paddle/fluid/tests/unittests/white_list/no_grad_set_white_list.py" ];then
echo_line="You must have one RD (Shixiaowei02 (Recommend), luotao1 or phlrain) approval for the python/paddle/fluid/tests/unittests/white_list/no_grad_set_white_list.py, which manages the white list of no_grad_set without value in operators. For more information, please refer to[https://github.com/PaddlePaddle/Paddle/wiki/It's-recommend-to-set-no_grad_set-to-be-None].\n" echo_line="You must have one RD (Shixiaowei02 (Recommend), luotao1 or phlrain) approval for the python/paddle/fluid/tests/unittests/white_list/no_grad_set_white_list.py, which manages the white list of no_grad_set without value in operators. For more information, please refer to[https://github.com/PaddlePaddle/Paddle/wiki/It's-recommend-to-set-no_grad_set-to-be-None].\n"
check_approval 1 39303645 6836917 43953930 check_approval 1 39303645 6836917 43953930
elif [ "${API_FILE}" == "tools/wlist.json" ];then
echo_line="You must have one TPM (jzhang533) approval for the api whitelist for the tools/wlist.json.\n"
check_approval 1 29231
elif [ "${API_FILE}" == "tools/sampcd_processor.py" ];then elif [ "${API_FILE}" == "tools/sampcd_processor.py" ];then
echo_line="test_sampcd_processor.py will be executed for changed sampcd_processor.py.\n" echo_line="test_sampcd_processor.py will be executed for changed sampcd_processor.py.\n"
run_test_sampcd_processor run_tools_test test_sampcd_processor.py
elif [ "${API_FILE}" == "tools/print_signatures.py" ];then
echo_line="test_print_signatures.py will be executed for changed print_signatures.py.\n"
run_tools_test test_print_signatures.py
elif [ "${API_FILE}" == "python/paddle/distributed/fleet/__init__.py" ]; then elif [ "${API_FILE}" == "python/paddle/distributed/fleet/__init__.py" ]; then
echo_line="You must have (fuyinno4 (Recommend), raindrops2sea) approval for ${API_FILE} changes" echo_line="You must have (fuyinno4 (Recommend), raindrops2sea) approval for ${API_FILE} changes"
check_approval 1 35824027 38231817 check_approval 1 35824027 38231817
......
此差异已折叠。
...@@ -20,15 +20,18 @@ import tempfile ...@@ -20,15 +20,18 @@ import tempfile
import shutil import shutil
import sys import sys
import importlib import importlib
import re
import sampcd_processor
from sampcd_processor import find_all from sampcd_processor import find_all
from sampcd_processor import check_indent
from sampcd_processor import get_api_md5 from sampcd_processor import get_api_md5
from sampcd_processor import get_incrementapi from sampcd_processor import get_incrementapi
from sampcd_processor import get_wlist
from sampcd_processor import sampcd_extract_to_file from sampcd_processor import sampcd_extract_to_file
from sampcd_processor import extract_code_blocks_from_docstr
from sampcd_processor import execute_samplecode from sampcd_processor import execute_samplecode
from sampcd_processor import find_last_future_line_end
SAMPLECODE_TEMP_DIR = 'samplecode_temp' from sampcd_processor import insert_codes_into_codeblock
from sampcd_processor import get_test_capacity
from sampcd_processor import is_required_match
class Test_find_all(unittest.TestCase): class Test_find_all(unittest.TestCase):
...@@ -43,27 +46,246 @@ class Test_find_all(unittest.TestCase): ...@@ -43,27 +46,246 @@ class Test_find_all(unittest.TestCase):
find_all(' hello, world; hello paddle!', 'hello')) find_all(' hello, world; hello paddle!', 'hello'))
class Test_check_indent(unittest.TestCase): class Test_find_last_future_line_end(unittest.TestCase):
def test_no_indent(self): def test_no_instant(self):
self.assertEqual(0, check_indent('hello paddle')) samplecodes = """
print(10//3)
"""
self.assertIsNone(find_last_future_line_end(samplecodes))
def test_1_instant(self):
samplecodes = """
from __future__ import print_function
print(10//3)
"""
mo = re.search("print_function\n", samplecodes)
self.assertIsNotNone(mo)
self.assertGreaterEqual(
find_last_future_line_end(samplecodes), mo.end())
def test_2_instant(self):
samplecodes = """
from __future__ import print_function
from __future__ import division
print(10//3)
"""
mo = re.search("division\n", samplecodes)
self.assertIsNotNone(mo)
self.assertGreaterEqual(
find_last_future_line_end(samplecodes), mo.end())
class Test_extract_code_blocks_from_docstr(unittest.TestCase):
def test_no_samplecode(self):
docstr = """
placeholder
"""
codeblocks = extract_code_blocks_from_docstr(docstr)
self.assertListEqual([], codeblocks)
def test_codeblock_before_examples_is_ignored(self):
docstr = """
.. code-block:: python
print(1+1)
Examples:
"""
codeblocks = extract_code_blocks_from_docstr(docstr)
self.assertListEqual(codeblocks, [])
def test_1_samplecode(self):
docstr = """
Examples:
.. code-block:: python
print(1+1)
"""
codeblocks = extract_code_blocks_from_docstr(docstr)
self.assertListEqual(codeblocks, [{
'codes': """print(1+1)""",
'name': None,
'id': 1,
'required': None,
}])
def test_2_samplecodes(self):
docstr = """
placeholder
Examples:
.. code-block:: python
print(1/0)
.. code-block:: python
:name: one_plus_one
:linenos:
# required: gpu
print(1+1)
"""
codeblocks = extract_code_blocks_from_docstr(docstr)
self.assertListEqual(codeblocks, [{
'codes': """print(1/0)""",
'name': None,
'id': 1,
'required': None,
}, {
'codes': """# required: gpu
print(1+1)""",
'name': 'one_plus_one',
'id': 2,
'required': 'gpu',
}])
class Test_insert_codes_into_codeblock(unittest.TestCase):
def test_required_None(self):
codeblock = {
'codes': """print(1/0)""",
'name': None,
'id': 1,
'required': None,
}
self.assertEqual("""
import os
os.environ["CUDA_VISIBLE_DEVICES"] = ""
print(1/0)
print("not-specified's sample code (name:None, id:1) is executed successfully!")""",
insert_codes_into_codeblock(codeblock))
def test_required_gpu(self):
codeblock = {
'codes': """# required: gpu
print(1+1)""",
'name': None,
'id': 1,
'required': 'gpu',
}
self.assertEqual("""
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
# required: gpu
print(1+1)
print("not-specified's sample code (name:None, id:1) is executed successfully!")""",
insert_codes_into_codeblock(codeblock))
def test_from_future(self):
codeblock = {
'codes': """
from __future__ import print_function
from __future__ import division
print(10//3)""",
'name': 'future',
'id': 1,
'required': None,
}
self.assertEqual("""
from __future__ import print_function
from __future__ import division
import os
os.environ["CUDA_VISIBLE_DEVICES"] = ""
print(10//3)
print("not-specified's sample code (name:future, id:1) is executed successfully!")""",
insert_codes_into_codeblock(codeblock))
def clear_capacity():
sampcd_processor.SAMPLE_CODE_TEST_CAPACITY = set()
sampcd_processor.RUN_ON_DEVICE = 'cpu'
if sampcd_processor.ENV_KEY_TEST_CAPACITY in os.environ:
del os.environ[sampcd_processor.ENV_KEY_TEST_CAPACITY]
def test_indent_4_spaces(self):
self.assertEqual(4, check_indent(' hello paddle'))
def test_indent_1_tab(self): class Test_get_test_capacity(unittest.TestCase):
self.assertEqual(4, check_indent("\thello paddle")) def setUp(self):
clear_capacity()
get_test_capacity()
def tearDown(self):
clear_capacity()
get_test_capacity()
def test_NoEnvVar(self):
clear_capacity()
get_test_capacity()
self.assertCountEqual(['cpu', ],
sampcd_processor.SAMPLE_CODE_TEST_CAPACITY)
def test_NoEnvVar_RUN_ON_DEVICE_gpu(self):
clear_capacity()
sampcd_processor.RUN_ON_DEVICE = 'gpu'
get_test_capacity()
self.assertCountEqual(['cpu', 'gpu'],
sampcd_processor.SAMPLE_CODE_TEST_CAPACITY)
def test_EnvVar_gpu(self):
clear_capacity()
os.environ[sampcd_processor.ENV_KEY_TEST_CAPACITY] = 'gpu'
get_test_capacity()
self.assertCountEqual(['cpu', 'gpu'],
sampcd_processor.SAMPLE_CODE_TEST_CAPACITY)
def test_EnvVar_gpu_and_distributed(self):
clear_capacity()
os.environ[sampcd_processor.ENV_KEY_TEST_CAPACITY] = 'gpu,distributed'
get_test_capacity()
self.assertCountEqual(['cpu', 'gpu', 'distributed'],
sampcd_processor.SAMPLE_CODE_TEST_CAPACITY)
class Test_is_required_match(unittest.TestCase):
def setUp(self):
clear_capacity()
def tearDown(self):
clear_capacity()
get_test_capacity()
def test_alldefault(self):
clear_capacity()
get_test_capacity()
self.assertTrue(is_required_match(''))
self.assertTrue(is_required_match(None))
self.assertTrue(is_required_match('cpu'))
self.assertFalse(is_required_match('gpu'))
self.assertIsNone(is_required_match('skiptest'))
self.assertIsNone(is_required_match('skip'))
self.assertIsNone(is_required_match('cpu,skiptest'))
def test_gpu_equipped(self):
clear_capacity()
os.environ[sampcd_processor.ENV_KEY_TEST_CAPACITY] = 'gpu'
get_test_capacity()
self.assertTrue(is_required_match('cpu'))
self.assertTrue(is_required_match('gpu'))
self.assertTrue(is_required_match('gpu,cpu'))
self.assertIsNone(is_required_match('skiptest'))
self.assertFalse(is_required_match('distributed'))
def test_gpu_distributed_equipped(self):
clear_capacity()
os.environ[sampcd_processor.ENV_KEY_TEST_CAPACITY] = 'gpu,distributed'
get_test_capacity()
self.assertTrue(is_required_match('cpu'))
self.assertTrue(is_required_match('gpu'))
self.assertTrue(is_required_match('distributed'))
self.assertFalse(is_required_match('xpu'))
self.assertIsNone(is_required_match('skiptest'))
class Test_execute_samplecode(unittest.TestCase): class Test_execute_samplecode(unittest.TestCase):
def setUp(self): def setUp(self):
if not os.path.exists(SAMPLECODE_TEMP_DIR): if not os.path.exists(sampcd_processor.SAMPLECODE_TEMPDIR):
os.mkdir(SAMPLECODE_TEMP_DIR) os.mkdir(sampcd_processor.SAMPLECODE_TEMPDIR)
self.successSampleCodeFile = os.path.join(SAMPLECODE_TEMP_DIR, self.successSampleCodeFile = os.path.join(
'samplecode_success.py') sampcd_processor.SAMPLECODE_TEMPDIR, 'samplecode_success.py')
with open(self.successSampleCodeFile, 'w') as f: with open(self.successSampleCodeFile, 'w') as f:
f.write('print(1+1)') f.write('print(1+1)')
self.failedSampleCodeFile = os.path.join(SAMPLECODE_TEMP_DIR, self.failedSampleCodeFile = os.path.join(
'samplecode_failed.py') sampcd_processor.SAMPLECODE_TEMPDIR, 'samplecode_failed.py')
with open(self.failedSampleCodeFile, 'w') as f: with open(self.failedSampleCodeFile, 'w') as f:
f.write('print(1/0)') f.write('print(1/0)')
...@@ -72,37 +294,41 @@ class Test_execute_samplecode(unittest.TestCase): ...@@ -72,37 +294,41 @@ class Test_execute_samplecode(unittest.TestCase):
os.remove(self.failedSampleCodeFile) os.remove(self.failedSampleCodeFile)
def test_run_success(self): def test_run_success(self):
result, tfname, msg = execute_samplecode(self.successSampleCodeFile) result, tfname, msg, exec_time = execute_samplecode(
self.successSampleCodeFile)
self.assertTrue(result) self.assertTrue(result)
self.assertEqual(self.successSampleCodeFile, tfname) self.assertEqual(self.successSampleCodeFile, tfname)
self.assertIsNotNone(msg) self.assertIsNotNone(msg)
self.assertLess(msg.find('skipped'), 0) self.assertLess(msg.find('skipped'), 0)
self.assertLess(exec_time, 10)
def test_run_failed(self): def test_run_failed(self):
result, tfname, msg = execute_samplecode(self.failedSampleCodeFile) result, tfname, msg, exec_time = execute_samplecode(
self.failedSampleCodeFile)
self.assertFalse(result) self.assertFalse(result)
self.assertEqual(self.failedSampleCodeFile, tfname) self.assertEqual(self.failedSampleCodeFile, tfname)
self.assertIsNotNone(msg) self.assertIsNotNone(msg)
self.assertLess(msg.find('skipped'), 0) self.assertLess(msg.find('skipped'), 0)
self.assertLess(exec_time, 10)
def test_testcases_skipped(self):
... def clear_summary_info():
tfname = os.path.join(SAMPLECODE_TEMP_DIR, 'samplecode_skipped.py') for k in sampcd_processor.SUMMARY_INFO.keys():
with open(tfname, 'w') as f: sampcd_processor.SUMMARY_INFO[k].clear()
f.write("# required: distributed\nprint(1/0)")
result, _, msg = execute_samplecode(tfname)
self.assertTrue(result)
self.assertGreaterEqual(msg.find('skipped'), 0)
os.remove(tfname)
class Test_sampcd_extract_to_file(unittest.TestCase): class Test_sampcd_extract_to_file(unittest.TestCase):
def setUp(self): def setUp(self):
if not os.path.exists(SAMPLECODE_TEMP_DIR): if not os.path.exists(sampcd_processor.SAMPLECODE_TEMPDIR):
os.mkdir(SAMPLECODE_TEMP_DIR) os.mkdir(sampcd_processor.SAMPLECODE_TEMPDIR)
clear_capacity()
os.environ[sampcd_processor.ENV_KEY_TEST_CAPACITY] = 'gpu,distributed'
get_test_capacity()
def tearDown(self): def tearDown(self):
shutil.rmtree(SAMPLECODE_TEMP_DIR) shutil.rmtree(sampcd_processor.SAMPLECODE_TEMPDIR)
clear_capacity()
get_test_capacity()
def test_1_samplecode(self): def test_1_samplecode(self):
comments = """ comments = """
...@@ -113,9 +339,10 @@ class Test_sampcd_extract_to_file(unittest.TestCase): ...@@ -113,9 +339,10 @@ class Test_sampcd_extract_to_file(unittest.TestCase):
""" """
funcname = 'one_plus_one' funcname = 'one_plus_one'
sample_code_filenames = sampcd_extract_to_file(comments, funcname) sample_code_filenames = sampcd_extract_to_file(comments, funcname)
self.assertCountEqual( self.assertCountEqual([
[os.path.join(SAMPLECODE_TEMP_DIR, funcname + '_example.py')], os.path.join(sampcd_processor.SAMPLECODE_TEMPDIR,
sample_code_filenames) funcname + '_example.py')
], sample_code_filenames)
def test_no_samplecode(self): def test_no_samplecode(self):
comments = """ comments = """
...@@ -140,10 +367,64 @@ class Test_sampcd_extract_to_file(unittest.TestCase): ...@@ -140,10 +367,64 @@ class Test_sampcd_extract_to_file(unittest.TestCase):
funcname = 'one_plus_one' funcname = 'one_plus_one'
sample_code_filenames = sampcd_extract_to_file(comments, funcname) sample_code_filenames = sampcd_extract_to_file(comments, funcname)
self.assertCountEqual([ self.assertCountEqual([
os.path.join(SAMPLECODE_TEMP_DIR, funcname + '_example_1.py'), os.path.join(sampcd_processor.SAMPLECODE_TEMPDIR,
os.path.join(SAMPLECODE_TEMP_DIR, funcname + '_example_2.py') funcname + '_example_1.py'),
os.path.join(sampcd_processor.SAMPLECODE_TEMPDIR,
funcname + '_example_2.py')
], sample_code_filenames) ], sample_code_filenames)
def test_2_samplecodes_has_skipped(self):
comments = """
placeholder
Examples:
.. code-block:: python
# required: skiptest
print(1/0)
.. code-block:: python
print(1+1)
.. code-block:: python
# required: gpu
print(1//1)
.. code-block:: python
# required: xpu
print(1//1)
.. code-block:: python
# required: distributed
print(1//1)
.. code-block:: python
# required: gpu
print(1//1)
"""
funcname = 'one_plus_one'
clear_summary_info()
clear_capacity()
get_test_capacity()
sample_code_filenames = sampcd_extract_to_file(comments, funcname)
self.assertCountEqual([
os.path.join(sampcd_processor.SAMPLECODE_TEMPDIR,
funcname + '_example_2.py')
], sample_code_filenames)
self.assertCountEqual(sampcd_processor.SUMMARY_INFO['skiptest'],
[funcname + '-1'])
self.assertCountEqual(sampcd_processor.SUMMARY_INFO['gpu'],
[funcname + '-3', funcname + '-6'])
self.assertCountEqual(sampcd_processor.SUMMARY_INFO['xpu'],
[funcname + '-4'])
self.assertCountEqual(sampcd_processor.SUMMARY_INFO['distributed'],
[funcname + '-5'])
class Test_get_api_md5(unittest.TestCase): class Test_get_api_md5(unittest.TestCase):
def setUp(self): def setUp(self):
...@@ -208,55 +489,6 @@ class Test_get_incrementapi(unittest.TestCase): ...@@ -208,55 +489,6 @@ class Test_get_incrementapi(unittest.TestCase):
], lines) ], lines)
class Test_get_wlist(unittest.TestCase):
def setUp(self):
self.tmpDir = tempfile.mkdtemp()
self.wlist_filename = os.path.join(self.tmpDir, 'wlist.json')
with open(self.wlist_filename, 'w') as f:
f.write(r'''
{
"wlist_dir":[
{
"name":"../python/paddle/fluid/contrib",
"annotation":""
},
{
"name":"../python/paddle/verison.py",
"annotation":""
}
],
"wlist_api":[
{
"name":"xxxxx",
"annotation":"not a real api, just for example"
}
],
"wlist_temp_api":[
"to_tensor",
"save_persistables@dygraph/checkpoint.py"
],
"gpu_not_white":[
"deformable_conv"
]
}
''')
def tearDown(self):
os.remove(self.wlist_filename)
shutil.rmtree(self.tmpDir)
def test_get_wlist(self):
wlist, wlist_file, gpu_not_white = get_wlist(self.wlist_filename)
self.assertCountEqual(
["xxxxx", "to_tensor",
"save_persistables@dygraph/checkpoint.py"], wlist)
self.assertCountEqual([
"../python/paddle/fluid/contrib",
"../python/paddle/verison.py",
], wlist_file)
self.assertCountEqual(["deformable_conv"], gpu_not_white)
# https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/layers/ops.py # https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/layers/ops.py
# why? unabled to use the ast module. emmmmm # why? unabled to use the ast module. emmmmm
......
{
"wlist_dir":[
{
"name":"../python/paddle/fluid/contrib",
"annotation":""
},
{
"name":"../python/paddle/verison.py",
"annotation":""
},
{
"name":"../python/paddle/fluid/core_avx.py",
"annotation":""
},
{
"name":"../python/paddle/distributed",
"annotation":""
}
],
"wlist_api":[
{
"name":"xxxxx",
"annotation":"not a real api, just for example"
},
{
"name":"squeeze_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"unsqueeze_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"reshape_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"flatten_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"scatter_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"elu_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"relu_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"softmax_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"tanh_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"ceil_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"floor_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"exp_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"reciprocal_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"round_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"sqrt_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"rsqrt_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"clip_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"scale_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"subtract_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
},
{
"name":"add_",
"annotation":"Inplace APIs don't need sample code. There is a special document introducing Inplace strategy"
}
],
"wlist_temp_api":[
"to_tensor",
"LRScheduler",
"ReduceOnPlateau",
"append_LARS",
"BuildStrategy.debug_graphviz_path",
"BuildStrategy.enable_sequential_execution",
"BuildStrategy.fuse_elewise_add_act_ops",
"BuildStrategy.fuse_relu_depthwise_conv",
"BuildStrategy.gradient_scale_strategy",
"BuildStrategy.reduce_strategy",
"BuildStrategy.remove_unnecessary_lock",
"BuildStrategy.sync_batch_norm",
"DynamicRNN.step_input",
"DynamicRNN.static_input",
"DynamicRNN.block",
"DynamicRNN.update_memory",
"DynamicRNN.output",
"transpiler.DistributeTranspilerConfig",
"transpiler.DistributeTranspilerConfig.slice_var_up",
"transpiler.DistributeTranspilerConfig.split_method",
"transpiler.DistributeTranspilerConfig.min_block_size",
"DistributeTranspilerConfig.slice_var_up",
"DistributeTranspilerConfig.split_method",
"ModelAverage.apply",
"ModelAverage.restore",
"DistributeTranspilerConfig",
"DistributeTranspilerConfig.min_block_size",
"ExecutionStrategy.allow_op_delay",
"load",
"Accuracy.update",
"ChunkEvaluator.update",
"ExecutionStrategy.num_iteration_per_drop_scope",
"ExecutionStrategy.num_threads",
"CompiledProgram._with_inference_optimize",
"CompositeMetric.add_metric",
"CompositeMetric.update",
"CompositeMetric.eval",
"DetectionMAP.get_map_var",
"MetricBase",
"MetricBase.reset",
"MetricBase.get_config",
"MetricBase.update",
"MetricBase.eval",
"Accuracy.eval",
"Auc.update",
"Auc.eval",
"EditDistance.update",
"EditDistance.eval",
"ExponentialMovingAverage.apply",
"ExponentialMovingAverage.restore",
"ExponentialMovingAverage.update",
"StaticRNN.step",
"StaticRNN.step_input",
"StaticRNN.step_output",
"StaticRNN.update_memory",
"DetectionMAP.reset",
"StaticRNN.output",
"cuda_places",
"CUDAPinnedPlace",
"CUDAPlace",
"Program.parse_from_string",
"Compressor",
"Compressor.config",
"Compressor.run",
"HDFSClient.upload",
"HDFSClient.download",
"HDFSClient.is_exist",
"HDFSClient.is_dir",
"HDFSClient.delete",
"HDFSClient.rename",
"HDFSClient.makedirs",
"HDFSClient.ls",
"HDFSClient.lsr",
"multi_download",
"multi_upload",
"TrainingDecoder.block",
"QuantizeTranspiler.training_transpile",
"QuantizeTranspiler.freeze_program",
"AutoMixedPrecisionLists",
"Uniform.sample",
"Uniform.log_prob",
"Uniform.entropy",
"Categorical.kl_divergence",
"Categorical.entropy",
"MultivariateNormalDiag.entropy",
"MultivariateNormalDiag.kl_divergence",
"RNNCell",
"RNNCell.call",
"RNNCell.get_initial_states",
"GRUCell.call",
"LSTMCell.call",
"Decoder",
"Decoder.initialize",
"Decoder.step",
"Decoder.finalize",
"fused_elemwise_activation",
"search_pyramid_hash",
"convert_dist_to_sparse_program",
"load_persistables_for_increment",
"load_persistables_for_inference",
"xmap_readers",
"Metric.reset",
"Metric.update",
"Metric.accumulate",
"Metric.name",
"Metric.compute",
"Accuracy.reset",
"Accuracy.update",
"Accuracy.accumulate",
"Accuracy.name",
"Accuracy.compute",
"Precision.reset",
"Precision.update",
"Precision.accumulate",
"Precision.name",
"Precision.compute",
"Recall.reset",
"Recall.update",
"Recall.accumulate",
"Recall.name",
"Recall.compute",
"Auc.reset",
"Auc.update",
"Auc.accumulate",
"Auc.name",
"Auc.compute",
"Callback.set_params",
"Callback.on_train_begin",
"Callback.on_train_end",
"Callback.on_eval_begin",
"Callback.on_eval_end",
"Callback.on_test_begin",
"Callback.on_test_end",
"Callback.on_epoch_begin",
"Callback.on_epoch_end",
"Callback.on_train_batch_begin",
"Callback.on_train_batch_end",
"Callback.on_eval_batch_begin",
"Callback.on_eval_batch_end",
"Callback.on_test_batch_begin",
"Callback.on_test_batch_end",
"Model.prepare",
"SimpleRNNCell",
"SimpleRNNCell.forward",
"LSTMCell",
"LSTMCell.forward",
"GRUCell",
"GRUCell.forward",
"SimpleRNN",
"GRU",
"LSTM",
"RNN",
"BiRNN",
"RNNCellBase",
"RNNCellBase.get_initial_states",
"gelu",
"erf",
"DecodeHelper",
"DecodeHelper.initialize",
"DecodeHelper.sample",
"DecodeHelper.next_inputs",
"TrainingHelper.initialize",
"TrainingHelper.sample",
"TrainingHelper.next_inputs",
"GreedyEmbeddingHelper.initialize",
"GreedyEmbeddingHelper.sample",
"GreedyEmbeddingHelper.next_inputs",
"LayerList.append",
"HDFSClient",
"InitState",
"TracedLayer",
"SampleEmbeddingHelper.sample",
"BasicDecoder.initialize",
"BasicDecoder.step",
"ParameterList.append",
"GreedyEmbeddingHelper",
"SampleEmbeddingHelper",
"BasicDecoder",
"lstm",
"partial_sum",
"StateCell",
"StateCell.compute_state",
"TrainingDecoder",
"TrainingDecoder.step_input",
"TrainingDecoder.static_input",
"TrainingDecoder.output",
"BeamSearchDecoder",
"GradClipByValue",
"GradClipByNorm",
"Variable.detach",
"Variable.numpy",
"Variable.set_value",
"Variable.gradient",
"BeamSearchDecoder.decode",
"BeamSearchDecoder.read_array",
"CompiledProgram",
"CompiledProgram.with_data_parallel",
"append_backward",
"guard",
"to_variable",
"op_freq_statistic",
"save_dygraph",
"load_dygraph",
"ParallelExecutor",
"ParallelExecutor.run",
"ParallelExecutor.drop_local_exe_scopes",
"GradClipByGlobalNorm",
"extend_with_decoupled_weight_decay",
"switch",
"Normal",
"memory_usage",
"decorate",
"PiecewiseDecay",
"InverseTimeDecay",
"PolynomialDecay",
"NoamDecay",
"start_profiler",
"profiler",
"tree_conv",
"multiclass_nms2",
"DataFeedDesc",
"Conv2D",
"Conv3D",
"Conv3DTranspose",
"Embedding",
"NCE",
"PRelu",
"BilinearTensorProduct",
"GroupNorm",
"SpectralNorm",
"TreeConv",
"prroi_pool",
"ChunkEvaluator",
"EditDistance",
"ErrorClipByValue",
"Program.clone",
"cuda_pinned_places",
"DataFeeder",
"elementwise_floordiv",
"Layer",
"Layer.create_parameter",
"Layer.create_variable",
"Layer.sublayers",
"Layer.add_parameter",
"Layer.add_sublayer",
"Layer.parameters",
"Tracer",
"Layer.full_name",
"InMemoryDataset",
"layer_norm",
"bipartite_match",
"double_buffer",
"cumsum",
"thresholded_relu",
"group_norm",
"random_crop",
"row_conv",
"hard_shrink",
"ssd_loss",
"retinanet_target_assign",
"InMemoryDataset.global_shuffle",
"InMemoryDataset.get_memory_data_size",
"DetectionMAP",
"hash",
"InMemoryDataset.set_queue_num",
"LayerNorm",
"Preprocessor",
"chunk_eval",
"GRUUnit",
"ExponentialMovingAverage",
"QueueDataset.global_shuffle",
"NumpyArrayInitializer",
"create_py_reader_by_data",
"InMemoryDataset.local_shuffle",
"InMemoryDataset.get_shuffle_data_size",
"size",
"edit_distance",
"nce",
"BilinearInitializer",
"NaturalExpDecay",
"noam_decay",
"retinanet_detection_output",
"Pool2D",
"PipelineOptimizer",
"generate_mask_labels",
"isfinite",
"InMemoryDataset.set_fleet_send_batch_size",
"cuda_profiler",
"unfold",
"Executor",
"InMemoryDataset.load_into_memory",
"ExponentialDecay",
"BatchNorm",
"deformable_conv",
"InMemoryDataset.preload_into_memory",
"py_reader",
"linear_lr_warmup",
"InMemoryDataset.wait_preload_done",
"CosineDecay",
"roi_perspective_transform",
"unique",
"ones_like",
"LambOptimizer",
"InMemoryDataset.release_memory",
"Conv2DTranspose",
"QueueDataset.local_shuffle",
"save_persistables@dygraph/checkpoint.py",
"load_persistables@dygraph/checkpoint.py",
"elementwise_pow",
"WeightedAverage.reset",
"ChunkEvaluator.eval",
"NCE.forward",
"elementwise_div",
"BilinearTensorProduct.forward",
"NoamDecay.step",
"elementwise_min",
"PiecewiseDecay.step",
"Conv3DTranspose.forward",
"elementwise_add",
"IfElse.output",
"IfElse.true_block",
"InverseTimeDecay.step",
"PolynomialDecay.step",
"Precision.eval",
"enabled",
"elementwise_max",
"stop_gperf_profiler",
"IfElse.false_block",
"WeightedAverage.add",
"Auc.trapezoid_area",
"elementwise_mul",
"GroupNorm.forward",
"SpectralNorm.forward",
"elementwise_sub",
"Switch.case",
"IfElse.input",
"prepare_context",
"PRelu.forward",
"Recall.update",
"start_gperf_profiler",
"TreeConv.forward",
"Conv2D.forward",
"Switch.default",
"elementwise_mod",
"Precision.update",
"WeightedAverage.eval",
"Conv3D.forward",
"Embedding.forward",
"Recall.eval",
"FC.forward",
"While.block",
"DGCMomentumOptimizer",
"ParallelEnv",
"spawn",
"init_parallel_env",
"DataParallel",
"DataParallel.scale_loss",
"DataParallel.apply_collective_grads",
"BasicLSTMCell.forward",
"BasicGRUCell.forward",
"RNN.forward",
"StackedRNNCell.forward",
"StackedLSTMCell.forward",
"LSTM.forward",
"BidirectionalRNN.forward",
"BidirectionalLSTM.forward",
"StackedGRUCell.forward",
"GRU.forward",
"BidirectionalGRU.forward",
"DynamicDecode.forward",
"Conv1dPoolLayer.forward",
"CNNEncoder.forward",
"TransformerCell.forward",
"TransformerBeamSearchDecoder.step",
"MultiHeadAttention.forward",
"MultiHeadAttention.cal_kv",
"FFN.forward",
"TransformerEncoderLayer.forward",
"TransformerEncoder.forward",
"TransformerDecoderLayer.forward",
"TransformerDecoder.forward",
"TransformerDecoder.prepare_static_cache",
"TransformerDecoder.prepare_incremental_cache",
"LinearChainCRF.forward",
"CRFDecoding.forward",
"SequenceTagging.forward",
"XPUPlace",
"is_compiled_with_xpu",
"xpu_places"
],
"gpu_not_white":[
"deformable_conv",
"cuda_places",
"CUDAPinnedPlace",
"CUDAPlace",
"cuda_profiler",
"DGCMomentumOptimizer"
]
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册