Skip to content

Commit a563a48

Browse files
linbinyupytorchmergebot
authored andcommitted
[Edge] Add an option to avoid adding base ops to static op library (pytorch#84360)
Summary: We use a static op library in a test for PyTorch C++ usages, but don't want to introduce all base ops. Because the goal is to check if a given model can run on the exact op collection (i.e., fbios ops, fb4a ops), and these base ops are not present in real apps. So add an option to disable this feature. Test Plan: Build. Expect no change to existing targets. Differential Revision: D39164021 Pull Request resolved: pytorch#84360 Approved by: https://github.com/kit1980
1 parent ff56f1c commit a563a48

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pt_ops.bzl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def pt_operator_library(
1919
train = False,
2020
model = None,
2121
include_all_operators = False,
22+
include_base_operators = True,
2223
**kwargs):
2324
(model_name, model_versions, model_assets, model_traced_backends) = validate_and_extract_model_information(
2425
name,
@@ -28,8 +29,9 @@ def pt_operator_library(
2829
ops = [op.strip() for op in ops]
2930

3031
# If ops are specified, then we are in static selective build mode, so we append
31-
# base ops to this list to avoid additional special case logic in subsequent code.
32-
if len(ops) > 0:
32+
# base ops to this list to avoid additional special case logic in subsequent code,
33+
# unless include_base_operators is explicitly set to False (the default is True)
34+
if len(ops) > 0 and include_base_operators:
3335
ops.extend(PT_BASE_OPS)
3436

3537
labels = kwargs.pop("labels", [])

0 commit comments

Comments
 (0)