message: Add CheckArraySegments() to model verifier
  Add additional logic to check nullness of array segments vector.
diff: @@ -126,6 +126,25 @@ bool VerifyStringTensorBuffer(const Tensor& tensor, const Buffer& buffer,
  return true;
  }
  +bool CheckArraySegments(const DimensionMetadata* dim_metadata) {
  + if (dim_metadata->array_segments() == nullptr) {
  + return false;
  + }
  + switch (dim_metadata->array_segments_type()) {
  + case SparseIndexVector_Int32Vector:
  + return (dim_metadata->array_segments_as_Int32Vector()->values() !=
  + nullptr);
  + case SparseIndexVector_Uint16Vector:
  + return (dim_metadata->array_segments_as_Uint16Vector()->values() !=
  + nullptr);
  + case SparseIndexVector_Uint8Vector:
  + return (dim_metadata->array_segments_as_Uint8Vector()->values() !=
  + nullptr);
  + default:
  + return false;
  + }
  +}
  +
  int GetSizeOfSegments(const DimensionMetadata* dim_metadata) {
  switch (dim_metadata->array_segments_type()) {
  case SparseIndexVector_Int32Vector:
  @@ -155,6 +174,25 @@ int GetValueOfSegmentsAt(const DimensionMetadata* dim_metadata, const int i) {
  }
  }
  +bool CheckArrayIndices(const DimensionMetadata* dim_metadata) {
  + if (dim_metadata->array_indices() == nullptr) {
  + return false;
  + }
  + switch (dim_metadata->array_indices_type()) {
  + case SparseIndexVector_Int32Vector:
  + return (dim_metadata->array_indices_as_Int32Vector()->values() !=
  + nullptr);
  + case SparseIndexVector_Uint16Vector:
  + return (dim_metadata->array_indices_as_Uint16Vector()->values() !=
  + nullptr);
  + case SparseIndexVector_Uint8Vector:
  + return (dim_metadata->array_indices_as_Uint8Vector()->values() !=
  + nullptr);
  + default:
  + return false;
  + }
  +}
  +
  int GetSizeOfIndices(const DimensionMetadata* dim_metadata) {
  switch (dim_metadata->array_indices_type()) {
  case SparseIndexVector_Int32Vector:
  @@ -205,9 +243,8 @@ absl::optional<uint64_t> VerifyAndCountElements(
  // Each index in a dense dimension is stored implicitly.
  num_elements *= dim_metadata->dense_size();
  } else {
  - const auto* array_segments = dim_metadata->array_segments();
  - const auto* array_indices = dim_metadata->array_indices();
  - if (array_segments == nullptr || array_indices == nullptr) {
  + if (!CheckArraySegments(dim_metadata) ||
  + !CheckArrayIndices(dim_metadata)) {
  return absl::nullopt;
  }
  