import tensorflow as tf

        # Structured numpy arrays aren't supported.
        return np.array([], dtype=[("foo", np.float32)])

      def bad2():
        # Non-string python objects aren't supported.
        return tf.float32

      y, = tf.py_func(bad1, [], [tf.string])
      z, = tf.py_func(bad2, [], [tf.float64])
      with self.assertRaisesRegexp(errors.UnimplementedError,
                                   "Unsupported numpy type"):
        y.eval()
      with self.assertRaisesRegexp(errors.UnimplementedError,
                                   "Unsupported object type"):
        z.eval()

