original_docstring: Tests the RGB to HSV conversion matches a reference implementation.
docstring: Tests the RGB to HSV conversion matches a reference implementation.
docstring_tokens: Tests the RGB to HSV conversion matches a reference implementation .
code: def testRGBToHSVNumpy(self):
      """Tests the RGB to HSV conversion matches a reference implementation."""
      for nptype in self.float_types:
        rgb_flat = GenerateNumpyRandomRGB((64, 3)).astype(nptype)
        rgb_np = rgb_flat.reshape(4, 4, 4, 3)
        hsv_np = np.array([
            colorsys.rgb_to_hsv(
                r.astype(np.float64), g.astype(np.float64), b.astype(np.float64))
            for r, g, b in rgb_flat
        ])
        hsv_np = hsv_np.reshape(4, 4, 4, 3)
        with self.test_session():
          placeholder = array_ops.placeholder(nptype)
          with self.test_scope():
            hsv_op = image_ops.rgb_to_hsv(placeholder)
          hsv_tf = hsv_op.eval(feed_dict={placeholder: rgb_np})
        self.assertAllCloseAccordingToType(hsv_tf, hsv_np)
code_tokens: def testRGBToHSVNumpy ( self ) : for nptype in self . float_types : rgb_flat = GenerateNumpyRandomRGB ( ( 64 , 3 ) ) . astype ( nptype ) rgb_np = rgb_flat . reshape ( 4 , 4 , 4 , 3 ) hsv_np = np . array ( [ colorsys . rgb_to_hsv ( r . astype ( np . float64 ) , g . astype ( np . float64 ) , b . astype ( np . float64 ) ) for r , g , b in rgb_flat ] ) hsv_np = hsv_np . reshape ( 4 , 4 , 4 , 3 ) with self . test_session ( ) : placeholder = array_ops . placeholder ( nptype ) with self . test_scope ( ) : hsv_op = image_ops . rgb_to_hsv ( placeholder ) hsv_tf = hsv_op . eval ( feed_dict = { placeholder : rgb_np } ) self . assertAllCloseAccordingToType ( hsv_tf , hsv_np )
short_docstring: Tests the RGB to HSV conversion matches a reference implementation.
short_docstring_tokens: Tests the RGB to HSV conversion matches a reference implementation .
comment: """Tests the RGB to HSV conversion matches a reference implementation."""