Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate operator dispatch in Var #192

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Change log

- Value propagation of string tensors no longer raises an erroneous ``ValueError`` in some instances.

**Pending breaking changes**

- Usage of ``operator_overloading`` now triggers a ``DeprecationWarning``. This API is scheduled for removal in Spox ``0.14.0``. Consider using ``ndonnx`` as an alternative.
neNasko1 marked this conversation as resolved.
Show resolved Hide resolved

**Other changes**

- The adaption logic is not using inferred values as initializers anymore.
Expand Down
5 changes: 5 additions & 0 deletions src/spox/_future.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

"""Module containing experimental Spox features that may be standard in the future."""

import warnings
from collections.abc import Iterable
from contextlib import contextmanager
from typing import Optional, Union
Expand Down Expand Up @@ -201,6 +202,10 @@ def operator_overloading(
... return x * y
>>> assert foo()._get_value() == np.array(6)
"""
warnings.warn(
"using operator_overloading is deprecated, consider using https://github.com/Quantco/ndonnx instead",
neNasko1 marked this conversation as resolved.
Show resolved Hide resolved
DeprecationWarning,
)
prev_dispatcher = Var._operator_dispatcher
Var._operator_dispatcher = _NumpyLikeOperatorDispatcher(
op, type_promotion, constant_promotion
Expand Down