code: def set_size(a, validate_indices=True):
      """Compute number of unique elements along last dimension of `a`.
  
      Args:
        a: `SparseTensor`, with indices sorted in row-major order.
        validate_indices: Whether to validate the order and range of sparse indices
          in `a`. Note that setting this to `false` allows for undefined behavior
          when calling this function with invalid indices.
  
      Returns:
        `int32` `Tensor` of set sizes. For `a` ranked `n`, this is a `Tensor` with
        rank `n-1`, and the same 1st `n-1` dimensions as `a`. Each value is the
        number of unique elements in the corresponding `[0...n-1]` dimension of `a`.
  
      Raises:
        TypeError: If `a` is an invalid types.
      """
      a = sparse_tensor.convert_to_tensor_or_sparse_tensor(a, name="a")
      if not isinstance(a, sparse_tensor.SparseTensor):
          raise TypeError("Expected `SparseTensor`, got %s." % a)
      if a.values.dtype.base_dtype not in _VALID_DTYPES:
          raise TypeError(
              f"Invalid dtype `{a.values.dtype}` not in supported dtypes: "
              f"`{_VALID_DTYPES}`."
          )
      # pylint: disable=protected-access
      return gen_set_ops.set_size(
          a.indices, a.values, a.dense_shape, validate_indices
      )
  
file_path: tensorflow-upstream/tensorflow/python/ops/sets_impl.py
imports: from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.ops import gen_set_ops
  from tensorflow.python.util import dispatch
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 1 for calling a global function with example usage: set_size(a, validate_indices) and returns: gen_set_ops