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

Remove the Image<->np.ndarray equality comparison support #568

Merged
merged 2 commits into from
Nov 26, 2021
Merged

Remove the Image<->np.ndarray equality comparison support #568

merged 2 commits into from
Nov 26, 2021

Conversation

IRDonch
Copy link

@IRDonch IRDonch commented Nov 26, 2021

Summary

This support has some questionable semantics:

  • It's not symmetric (Image can be equal to ndarray, but not the other way around).

  • It doesn't behave the same as ndarray comparison (which returns an ndarray rather than bool), so it's not quite transitive either (if image == array1 and image == array2 are true, then array1 == array2 is not true (but an array of Trues).

Moreover, it's seemingly only used in two tests, and those tests can easily use np.testing.assert_array_equal instead, which has the added benefit of printing detailed mismatch information.

Inspired by the discussion in #521.

How to test

Checklist

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.
  • I have updated the license header for each file (see an example below)
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT

Roman Donchenko added 2 commits November 26, 2021 13:02
This support has some questionable semantics:

* It's not symmetric (`Image` can be equal to `ndarray`, but not the other
  way around).

* It doesn't behave the same as `ndarray` comparison (which returns
  an `ndarray` rather than `bool`), so it's not quite transitive either (if
  `image == array1` and `image == array2` are true, then `array1 == array2`
  is not true (but an array of `True`s).

Moreover, it's seemingly only used in two tests, and those tests can easily
use `np.testing.assert_array_equal` instead, which has the added benefit of
printing detailed mismatch information.
@zhiltsov-max
Copy link
Contributor

I'm not sure I'm totally agree with removing underused functionality, but the semantics point looks more or less significant. But I see it more like a Python design problem.

@zhiltsov-max zhiltsov-max merged commit 9cd9850 into openvinotoolkit:develop Nov 26, 2021
@IRDonch IRDonch deleted the image-array-equality branch September 9, 2022 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants