-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8147 from nicoddemus/backport-8137
[6.2.x] python_api: handle array-like args in approx() #8137
- Loading branch information
Showing
3 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Fixed regression in ``approx``: in 6.2.0 ``approx`` no longer raises | ||
``TypeError`` when dealing with non-numeric types, falling back to normal comparison. | ||
Before 6.2.0, array types like tf.DeviceArray fell through to the scalar case, | ||
and happened to compare correctly to a scalar if they had only one element. | ||
After 6.2.0, these types began failing, because they inherited neither from | ||
standard Python number hierarchy nor from ``numpy.ndarray``. | ||
|
||
``approx`` now converts arguments to ``numpy.ndarray`` if they expose the array | ||
protocol and are not scalars. This treats array-like objects like numpy arrays, | ||
regardless of size. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters