diff --git a/aten/src/ATen/core/op_registration/op_whitelist.h b/aten/src/ATen/core/op_registration/op_whitelist.h index 26d5533244d7..f93462bb2cfa 100644 --- a/aten/src/ATen/core/op_registration/op_whitelist.h +++ b/aten/src/ATen/core/op_registration/op_whitelist.h @@ -10,7 +10,7 @@ * set of operators (+ dependencies) included. * * - Build with -DTORCH_OPERATOR_WHITELIST="aten::add;aten::sub" and only these - * two ops will be included in your build. The whitelist records operators + * two ops will be included in your build. The allowlist records operators * only, no overloads; if you include aten::add, all overloads of aten::add * will be included. * @@ -19,9 +19,9 @@ * operator functions that weren't registered. * See Note [Selective build] for more details * - * WARNING: The whitelist mechanism doesn't work for all ways you could go about + * WARNING: The allowlist mechanism doesn't work for all ways you could go about * registering an operator. If the dispatch key / operator name is not - * sufficiently obvious at compile time, then the whitelisting mechanism + * sufficiently obvious at compile time, then the allowlisting mechanism * will fail (and the operator will be included in the binary anyway). */ @@ -33,21 +33,21 @@ namespace c10 { namespace impl { -// returns true iff whitelist contains item +// returns true iff allowlist contains item // op_whitelist_contains("a;bc;d", "bc") == true -constexpr bool op_whitelist_contains(string_view whitelist, string_view item) { +constexpr bool op_whitelist_contains(string_view allowlist, string_view item) { //Choose a really big value for next so that if something goes wrong //this code will blow up in a hopefully detectable way. size_t next = std::numeric_limits::max(); - for (size_t cur = 0; cur <= whitelist.size(); cur = next) { - next = whitelist.find(';', cur); + for (size_t cur = 0; cur <= allowlist.size(); cur = next) { + next = allowlist.find(';', cur); if (next != string_view::npos) { - if (whitelist.substr(cur, next - cur).compare(item) == 0) { + if (allowlist.substr(cur, next - cur).compare(item) == 0) { return true; } next++; } else { - if (whitelist.substr(cur).compare(item) == 0) { + if (allowlist.substr(cur).compare(item) == 0) { return true; } break; @@ -56,7 +56,7 @@ constexpr bool op_whitelist_contains(string_view whitelist, string_view item) { return false; } -// Returns true iff the given op name is on the whitelist +// Returns true iff the given op name is on the allowlist // and should be registered constexpr bool op_whitelist_check(string_view op_name) { assert(op_name.find("::") != string_view::npos); @@ -68,16 +68,16 @@ constexpr bool op_whitelist_check(string_view op_name) { return op_whitelist_contains( C10_STRINGIZE(TORCH_OPERATOR_WHITELIST), // This function is majorly used for mobile selective build with - // root operators, where the overload is included in the whitelist. + // root operators, where the overload is included in the allowlist. op_name); - // // Strip overload name (as whitelist doesn't contain overloads) + // // Strip overload name (as allowlist doesn't contain overloads) // // Another function based on this may be added when there's usage // // on op names without overload. // OperatorNameView::parse(op_name).name); #endif } -// Returns true iff the given schema string is on the whitelist +// Returns true iff the given schema string is on the allowlist // and should be registered constexpr bool schema_whitelist_check(string_view schema) { #if defined(TORCH_FORCE_SCHEMA_REGISTRATION) @@ -88,12 +88,12 @@ constexpr bool schema_whitelist_check(string_view schema) { } // schema_whitelist_check() implicitly depends on a macro, TORCH_OPERATOR_WHITELIST. -// Add this API to pass arbitrary whitelist. -constexpr bool op_whitelist_contains_name_in_schema(string_view whitelist, string_view schema) { - return op_whitelist_contains(whitelist, schema.substr(0, schema.find("("))); +// Add this API to pass arbitrary allowlist. +constexpr bool op_whitelist_contains_name_in_schema(string_view allowlist, string_view schema) { + return op_whitelist_contains(allowlist, schema.substr(0, schema.find("("))); } -// Returns true iff the given dispatch key is on the whitelist +// Returns true iff the given dispatch key is on the allowlist // and should be registered. When we turn this on, the list of valid // mobile dispatch keys is hard coded (but you need to make sure // that you have the correct set of dispatch keys for this). diff --git a/torch/quantization/quantization_mappings.py b/torch/quantization/quantization_mappings.py index 802d81d3ca0c..febc839e9093 100644 --- a/torch/quantization/quantization_mappings.py +++ b/torch/quantization/quantization_mappings.py @@ -89,7 +89,7 @@ nn.RNNCell: nnqd.RNNCell, } -# Whitelist for propagating the qconfig +# Allowlist for propagating the qconfig _INCLUDE_QCONFIG_PROPAGATE_LIST : Set[Callable] = { nn.Sequential, }