mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Tighten torch.library.infer_schema input types (#130705)
Made the following changes: - mutates_args is now keyword-only and mandatory. This is to align with torch.library.custom_op (which makes it mandatory because it's easy to miss) - op_name is now keyword-only. This helps the readability of the API - updated all usages of infer_schema This change is not BC-breaking because we introduced torch.library.infer_schema a couple of days ago. Test Plan: - tests Pull Request resolved: https://github.com/pytorch/pytorch/pull/130705 Approved by: https://github.com/yushangdi ghstack dependencies: #131777
This commit is contained in:
@ -104,7 +104,7 @@ def custom_op(qualname, func_or_schema=None):
|
||||
f"is passed to `custom_op`"
|
||||
)
|
||||
|
||||
schema = infer_schema(func)
|
||||
schema = infer_schema(func, mutates_args=())
|
||||
_custom_op_with_schema(qualname, schema)
|
||||
return func
|
||||
|
||||
|
Reference in New Issue
Block a user