@@ -626,12 +626,14 @@ class Dataset {
626626 }
627627
628628 if (slices.size () > internal::kMaxNumSlices ) {
629- return absl::InvalidArgumentError (
630- absl::StrCat (" Too many slices provided or implicitly generated. "
631- " Maximum number of slices is " ,
632- internal::kMaxNumSlices , " but " , slices.size (),
633- " were provided.\n\t Use -DMAX_NUM_SLICES cmake flag to "
634- " increase the maximum number of slices." ));
629+ std::size_t halfElements = slices.size () / 2 ;
630+ if (halfElements % 2 != 0 ) {
631+ halfElements += 1 ;
632+ }
633+ std::vector<RangeDescriptor<Index>> firstHalf (slices.begin (), slices.begin () + halfElements);
634+ std::vector<RangeDescriptor<Index>> secondHalf (slices.begin () + halfElements, slices.end ());
635+ MDIO_ASSIGN_OR_RETURN (auto ds, isel (firstHalf));
636+ return ds.isel (secondHalf);
635637 }
636638
637639 std::vector<RangeDescriptor<Index>> slicesCopy = slices;
@@ -1044,9 +1046,11 @@ class Dataset {
10441046 std::string (coord_desc.label .label ()) + " '" );
10451047 }
10461048
1049+ // TODO(BrianMichell): Coalesce the slices into fewer descriptors.
1050+
10471051 MDIO_ASSIGN_OR_RETURN (auto ds, isel (elementwiseSlices));
1052+ // TODO(BrianMichell): Make this method more async friendly.
10481053 return tensorstore::ReadyFuture<Dataset>(std::move (ds));
1049- // return isel(elementwiseSlices);
10501054}
10511055
10521056 /* *
0 commit comments