Whether two signature inputs/outputs match in dtype, shape and sparsity.

  Args:
    map_a: A proto map<string,TensorInfo>.
    map_b: A proto map<string,TensorInfo>.

  Returns:
    A boolean whether `map_a` and `map_b` tensors have the same dtype, shape and
    sparsity.

def tensor_info_proto_maps_match(map_a, map_b):
  """Whether two signature inputs/outputs match in dtype, shape and sparsity.

  Args:
    map_a: A proto map<string,TensorInfo>.
    map_b: A proto map<string,TensorInfo>.

  Returns:
    A boolean whether `map_a` and `map_b` tensors have the same dtype, shape and
    sparsity.
  """
  iter_a = sorted(parse_tensor_info_map(map_a).items())
  iter_b = sorted(parse_tensor_info_map(map_b).items())
  if len(iter_a) != len(iter_b):
    return False  # Mismatch count.
  for info_a, info_b in zip(iter_a, iter_b):
    if info_a[0] != info_b[0]:
      return False  # Mismatch keys.
    if _is_sparse(info_a[1]) != _is_sparse(info_b[1]):
      return False
    if info_a[1].dtype != info_b[1].dtype:
      return False
    if not _shape_match(info_a[1].get_shape(), info_b[1].get_shape()):
      return False
  return True