code: def test_invalid_sparse_tensors(self):
      # Test validation of invalid SparseTensors.  The SparseTensor constructor
      # prevents us from creating invalid SparseTensors (eps. in eager mode),
      # so we create valid SparseTensors and then modify them to be invalid.
  
      st1 = sparse_tensor.SparseTensor([[0, 0]], [0], [2, 2])
      st1._indices = array_ops.zeros([], dtypes.int64)
      with self.assertRaisesRegex(
          (errors.InvalidArgumentError, ValueError),
          "Input indices should be a matrix",
      ):
          self.evaluate(sparse_ops.sparse_cross([st1]))
  
      st2 = sparse_tensor.SparseTensor([[0, 0]], [0], [2, 2])
      st2._values = array_ops.zeros([], dtypes.int64)
      with self.assertRaisesRegex(
          (errors.InvalidArgumentError, ValueError),
          "Input values should be a vector",
      ):
          self.evaluate(sparse_ops.sparse_cross([st2]))
  
      st3 = sparse_tensor.SparseTensor([[0, 0]], [0], [2, 2])
      st3._dense_shape = array_ops.zeros([], dtypes.int64)
      with self.assertRaisesRegex(
          (errors.InvalidArgumentError, ValueError),
          "Input shapes should be a vector",
      ):
          self.evaluate(sparse_ops.sparse_cross([st3]))
  
imports: import numpy
  from tensorflow.python.client import session
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_sparse_ops
  from tensorflow.python.ops import sparse_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 22 for calling the SparseCrossOpTest obj's underlying member method code with example usage: obj.test_invalid_sparse_tensors() without return types