Ejemplo n.º 1
0
  def testEmptyLike(self):
    for a in self.all_arrays:
      actual = np_array_ops.empty_like(a)
      expected = np.empty_like(a)
      msg = 'array: {}'.format(a)
      self.match_shape(actual, expected, msg)
      self.match_dtype(actual, expected, msg)

    for a, t in itertools.product(self.all_arrays, self.all_types):
      actual = np_array_ops.empty_like(a, t)
      expected = np.empty_like(a, t)
      msg = 'array: {} type: {}'.format(a, t)
      self.match_shape(actual, expected, msg)
      self.match_dtype(actual, expected, msg)
 def testEmptyLike(self, a, dtype, unused_a_as_bytes):
   b = np_array_ops.empty_like(a, dtype=dtype)
   self.assertIsInstance(b.numpy(), bytes)
   self.assertEqual(b.numpy(), b'')