def testStructuredTensorLikeStructuredTensor(self):
     """Fully test structured_tensor_array_like."""
     foo = structured_tensor.StructuredTensor.from_pyval([{
         "a": 3
     }, {
         "a": 7
     }])
     result = structured_array_ops._structured_tensor_like(foo)
     self.assertAllEqual([{}, {}], result)
  def testStructuredTensorArrayLike(self):
    """There was a bug in a case in a private function.

    This was difficult to reach externally, so I wrote a test
    to check it directly.
    """
    rt = ragged_tensor.RaggedTensor.from_row_splits(
        array_ops.zeros(shape=[5, 3]), [0, 3, 5])
    result = structured_array_ops._structured_tensor_like(rt)
    self.assertEqual(3, result.rank)
 def testStructuredTensorArrayRankZero(self):
   """Fully test structured_tensor_array_like."""
   foo = array_ops.zeros(shape=[])
   result = structured_array_ops._structured_tensor_like(foo)
   self.assertAllEqual({}, result)
 def my_fun(my_shape):
   my_zeros = array_ops.zeros(my_shape)
   return structured_array_ops._structured_tensor_like(my_zeros)
 def testStructuredTensorArrayRankOneKnownShape(self):
   """Fully test structured_tensor_array_like."""
   foo = array_ops.zeros(shape=[4])
   result = structured_array_ops._structured_tensor_like(foo)
   self.assertAllEqual([{}, {}, {}, {}], result)
 def my_fun(foo):
   bar_shape = math_ops.range(foo)
   bar = array_ops.zeros(shape=bar_shape)
   structured_array_ops._structured_tensor_like(bar)