Goal
The goal of this issue is to track overall progress toward eliminating the use of the terms whitelist and blacklist from the PyTorch codebase. The recommended replacements for these terms are allowlist and blocklist, respectively. See this numpy issue for more information.
However, we should strive to use more specific and appropriate terms based on the context in which whitelist and blacklist are used. For example, if the code in question constructs a list of tests that are to be skipped and stores it into a variable called test_blacklist, test_skiplist would be a better choice than test_blocklist. But if there are no other options, allowlist and blocklist are the designated fallback terms.
How To Help
- Pick a file from the list below. Comment on the issue saying that you are working on it and assign it to yourself.
- Work on your task. Replace all instances of blacklist or whitelist as appropriate. Submit a PR. Make sure your PR complies with the PyTorch code review values.
- Choose someone who is familiar with the code in question to review your PR. GitHub UI can help with this.
- Merge your PR (or get someone from the team to merge it).
Unexpected Issues
It is possible that a simple find-and-replace strategy will not work for some of the occurrences in the list below. A good example is aten/src/ATen/gen.py; this tool has command-line flags with whitelist in them that are consumed by other tools. We need to be more careful in these cases. For now, if you come across a case like this, leave a comment in the issue detailing your findings and edit this post to link the corresponding file to that issue or comment below.
To-Do List
Blacklist
Whitelist
Goal
The goal of this issue is to track overall progress toward eliminating the use of the terms whitelist and blacklist from the PyTorch codebase. The recommended replacements for these terms are allowlist and blocklist, respectively. See this numpy issue for more information.
However, we should strive to use more specific and appropriate terms based on the context in which whitelist and blacklist are used. For example, if the code in question constructs a list of tests that are to be skipped and stores it into a variable called
test_blacklist,test_skiplistwould be a better choice thantest_blocklist. But if there are no other options, allowlist and blocklist are the designated fallback terms.How To Help
Unexpected Issues
It is possible that a simple find-and-replace strategy will not work for some of the occurrences in the list below. A good example is
aten/src/ATen/gen.py; this tool has command-line flags withwhitelistin them that are consumed by other tools. We need to be more careful in these cases. For now, if you come across a case like this, leave a comment in the issue detailing your findings and edit this post to link the corresponding file to that issue or comment below.To-Do List
Blacklist
.jenkins/pytorch/dirty.sh(Replace blacklist/whitelist in .jenkins/pytorch/dirty.sh #41699)aten/src/ATen/native/cudnn/Conv.cpp(Replace blacklist/whitelist in aten/src/ATen/native/cudnn/Conv.cpp #41700)caffe2/onnx/onnx_exporter.cc(Replace blacklist/whitelist in caffe2/onnx/onnx_exporter.cc #41701)caffe2/onnx/onnx_exporter.h(Replace blacklist/whitelist in caffe2/onnx/onnx_exporter.h #41702)caffe2/opt/backend_transformer_base.h(Replace blacklist/whitelist in caffe2/opt/backend_transformer_base.h #41703)caffe2/opt/onnxifi_transformer.cc(Replace blacklist/whitelist in caffe2/opt/onnxifi_transformer.cc #41704)caffe2/opt/onnxifi_transformer.h(Replace blacklist/whitelist in caffe2/opt/onnxifi_transformer.h #41705)caffe2/opt/tvm_transformer.cc(Replace blacklist/whitelist in caffe2/opt/tvm_transformer.cc #41706)caffe2/opt/tvm_transformer.h(Replace blacklist/whitelist in caffe2/opt/tvm_transformer.h #41707)caffe2/opt/custom/fakefp16_transform.cc(Replace blacklist/whitelist in caffe2/opt/custom/fakefp16_transform.cc #41708)caffe2/opt/custom/glow_net_transform.cc(Replace blacklist/whitelist in caffe2/opt/custom/glow_net_transform.cc #41709)caffe2/opt/custom/glow_net_transform.h(Replace blacklist/whitelist in caffe2/opt/custom/glow_net_transform.h #41710)caffe2/python/pybind_state.cc(Replace blacklist/whitelist in caffe2/python/pybind_state.cc #41711)caffe2/python/onnx/frontend.py(Replace blacklist/whitelist in caffe2/python/onnx/frontend.py #41712)cmake/Modules_CUDA_fix/upstream/FindCUDA.cmake(Replace blacklist/whitelist in cmake/Modules_CUDA_fix/upstream/FindCUDA.cmake #41713)cmake/public/cuda.cmake(Replace blacklist/whitelist in cmake/public/cuda.cmake #41714)docs/cpp/source/Doxyfile(Replace blacklist/whitelist in docs/cpp/source/Doxyfile #41715)test/run_test.py(Replace blacklist/whitelist in test/run_test.py #41716)test/test_jit.py(Replace blacklist/whitelist in test/test_jit.py #41717)test/test_mobile_optimizer.py(Replace blacklist/whitelist in test/test_mobile_optimizer.py #41718)test/test_type_hints.py(Replace blacklist/whitelist in test/test_type_hints.py #41719)tools/autograd/gen_python_functions.py(Replace blacklist/whitelist in tools/autograd/gen_python_functions.py #41720)tools/jit/gen_unboxing_wrappers.py(Replace blacklist/whitelist in tools/jit/gen_unboxing_wrappers.py #41721)tools/pyi/gen_pyi.py(Replace blacklist/whitelist in tools/pyi/gen_pyi.py #41722)torch/csrc/jit/passes/xnnpack_rewrite.cpp(Replace blacklist/whitelist in torch/csrc/jit/passes/xnnpack_rewrite.cpp #41723)torch/csrc/jit/passes/xnnpack_rewrite.h(Replace blacklist/whitelist in torch/csrc/jit/passes/xnnpack_rewrite.h #41724)torch/csrc/jit/python/init.cpp(Replace blacklist/whitelist in torch/csrc/jit/python/init.cpp #41725)torch/csrc/utils/python_arg_parser.cpp(Replace blacklist/whitelist in torch/csrc/utils/python_arg_parser.cpp #41726)torch/jit/_recursive.py(Replace blacklist/whitelist in torch/jit/_recursive.py #41727)torch/utils/mobile_optimizer.py(Replace blacklist/whitelist in torch/utils/mobile_optimizer.py #41728)torch/utils/hipify/hipify_python.py(Replace blacklist/whitelist in torch/utils/hipify/hipify_python.py #41729)caffe2/onnx/onnx_exporter.h(Replace blacklist/whitelist in caffe2/onnx/onnx_exporter.h #41730)caffe2/opt/tvm_transformer.cc(Replace blacklist/whitelist in caffe2/opt/tvm_transformer.cc #41731)caffe2/opt/custom/glow_net_transform.cc(Replace blacklist/whitelist in caffe2/opt/custom/glow_net_transform.cc #41732)test/backward_compatibility/check_backward_compatibility.py(Replace blacklist/whitelist in test/backward_compatibility/check_backward_compatibility.py #41733)caffe2/python/pybind_state.cc(Replace blacklist/whitelist in caffe2/python/pybind_state.cc #41734)caffe2/python/onnx/onnxifi.py(Replace blacklist/whitelist in caffe2/python/onnx/onnxifi.py #41735)torch/onnx/symbolic_helper.py(Replace blacklist/whitelist in torch/onnx/symbolic_helper.py #41736)torch/onnx/symbolic_opset7.py(Replace blacklist/whitelist in torch/onnx/symbolic_opset7.py #41737)torch/onnx/symbolic_opset8.py(Replace blacklist/whitelist in torch/onnx/symbolic_opset8.py #41738)Whitelist
CMakeLists.txt(Replace blacklist/whitelist in CMakeLists.txt #41739).circleci/cimodel/data/simple/binary_smoketest.py(Replace blacklist/whitelist in .circleci/cimodel/data/simple/binary_smoketest.py #41740).github/workflows/clang_format.yml(Replace blacklist/whitelist in .github/workflows/clang_format.yml #41741)aten/src/ATen/gen.py(Replace blacklist/whitelist in aten/src/ATen/gen.py #41742)caffe2/predictor/transforms.cc(Replace blacklist/whitelist in caffe2/predictor/transforms.cc #41744)caffe2/transforms/common_subexpression_elimination.cc(Replace blacklist/whitelist in caffe2/transforms/common_subexpression_elimination.cc #41745)caffe2/transforms/common_subexpression_elimination.h(Replace blacklist/whitelist in caffe2/transforms/common_subexpression_elimination.h #41746)cmake/Codegen.cmake(Replace blacklist/whitelist in cmake/Codegen.cmake #41747)cmake/Whitelist.cmake(Replace blacklist/whitelist in cmake/Whitelist.cmake #41748)test/test_namedtuple_return_api.py(Replace blacklist/whitelist in test/test_namedtuple_return_api.py #41749)test/backward_compatibility/check_backward_compatibility.py(Replace blacklist/whitelist in test/backward_compatibility/check_backward_compatibility.py #41750)test/quantization/test_quantized_op.py(Replace blacklist/whitelist in test/quantization/test_quantized_op.py #41751)tools/clang_format_all.py(Replace blacklist/whitelist in tools/clang_format_all.py #41752)tools/clang_format_ci.sh(Replace blacklist/whitelist in tools/clang_format_ci.sh #41753)tools/code_analyzer/gen_op_registration_whitelist.py(Replace blacklist/whitelist in tools/code_analyzer/gen_op_registration_whitelist.py #41754)torch/jit/_script.py(Replace blacklist/whitelist in torch/jit/_script.py #41755)torch/quantization/default_mappings.py(Replace blacklist/whitelist in torch/quantization/default_mappings.py #41756)caffe2/CMakeLists.txt(Replace blacklist/whitelist in caffe2/CMakeLists.txt #41757)test/test_autograd.py(Replace blacklist/whitelist in test/test_autograd.py #41758)torch/csrc/jit/passes/quantization/helper.cpp(Replace blacklist/whitelist in torch/csrc/jit/passes/quantization/helper.cpp #41759)torch/csrc/jit/passes/lower_tuples.cpp(Replace blacklist/whitelist in torch/csrc/jit/passes/lower_tuples.cpp #41761)torch/quantization/_numeric_suite.py(Replace blacklist/whitelist in torch/quantization/_numeric_suite.py #41762)torch/quantization/default_mappings.py(Replace blacklist/whitelist in torch/quantization/default_mappings.py #41763)torch/quantization/quantize.py(Replace blacklist/whitelist in torch/quantization/quantize.py #41764)