Skip to content

Commit 3e795f2

Browse files
authored
Introduce OpSignature to IR (#1838)
Introduce OpSignature accessible from the `.op_signature` property of all OpLike objects (traced function, onnx function and op). The OpSignature class leverages the IR to represent the signature of an operator, preserving ordering of all inputs and provides easy to work with type representations. The PR also deprecates the ParamSchema class and properties. Fixes #1697 The next PR will replace param_schemas usage.
1 parent 561a600 commit 3e795f2

File tree

4 files changed

+820
-17
lines changed

4 files changed

+820
-17
lines changed

onnxscript/_internal/deprecation.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
T = TypeVar("T")
1313

1414

15+
@functools.lru_cache(maxsize=1024)
16+
def _warn_once(message: str):
17+
"""Issue a FutureWarning only once per message."""
18+
warnings.warn(message, category=FutureWarning, stacklevel=3)
19+
20+
1521
def deprecated(since: str, removed_in: str, instructions: str) -> Callable[[T], T]:
1622
"""Marks functions as deprecated.
1723
@@ -30,12 +36,10 @@ def deprecated(since: str, removed_in: str, instructions: str) -> Callable[[T],
3036
def decorator(function):
3137
@functools.wraps(function)
3238
def wrapper(*args, **kwargs):
33-
warnings.warn(
39+
_warn_once(
3440
f"'{function.__module__}.{function.__qualname__}' "
3541
f"is deprecated in version {since} and will be "
3642
f"removed in {removed_in}. Please {instructions}.",
37-
category=FutureWarning,
38-
stacklevel=2,
3943
)
4044
return function(*args, **kwargs)
4145

0 commit comments

Comments
 (0)