Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Fix bbox_to_mask to return np.float32 #625

Merged
merged 2 commits into from
May 28, 2018

Conversation

knorth55
Copy link
Contributor

@knorth55 knorth55 commented May 28, 2018

np.testing.assert_equal does not check dtype!
I did not know that 馃槆 .

In [1]: import numpy as np

In [2]: a = np.array([1, 2, 3], dtype=np.float32)

In [3]: b = a.astype(np.float64)

In [4]: np.testing.assert_array_equal(a, b)

In [5]: a[2] = 4

In [6]: np.testing.assert_array_equal(a, b)
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-6-e23e3200d0b5> in <module>()
----> 1 np.testing.assert_array_equal(a, b)

/usr/lib/python2.7/dist-packages/numpy/testing/utils.pyc in assert_array_equal(x, y, err_msg, verbose)
    805     """
    806     assert_array_compare(operator.__eq__, x, y, err_msg=err_msg,
--> 807                          verbose=verbose, header='Arrays are not equal')
    808 
    809 def assert_array_almost_equal(x, y, decimal=6, err_msg='', verbose=True):

/usr/lib/python2.7/dist-packages/numpy/testing/utils.pyc in assert_array_compare(comparison, x, y, err_msg, verbose, header, precision)
    731                                 names=('x', 'y'), precision=precision)
    732             if not cond:
--> 733                 raise AssertionError(msg)
    734     except ValueError:
    735         import traceback

AssertionError: 
Arrays are not equal

(mismatch 33.3333333333%)
 x: array([ 1.,  2.,  4.], dtype=float32)
 y: array([ 1.,  2.,  3.])

Copy link
Member

@Hakuyume Hakuyume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Hakuyume Hakuyume merged commit 3bfdcd3 into chainer:master May 28, 2018
@knorth55 knorth55 deleted the fix-bbox-to-mask branch May 28, 2018 09:38
@knorth55 knorth55 mentioned this pull request May 29, 2018
13 tasks
@yuyu2172 yuyu2172 added this to the 0.10 milestone May 30, 2018
@yuyu2172 yuyu2172 added the bug label May 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants