aten/src/ATen/native/cuda/linalg/BatchLinearAlgebraLib.cpp
std::string _format_non_converging_batches(const std::vector<int64_t>& batches) {
  std::stringstream ss;
  const int too_long = 5;

  ss << "batches ";
  if (batches.size() <= too_long) {
    for (const auto i : c10::irange(batches.size() - 1)) {
      ss << batches[i] << ", ";
    }
    ss << batches.back();
  } else {
    for (const auto i : c10::irange(too_long)) {
      ss << batches[i] << ", ";
    }
    ss << "and other " << batches.size() - too_long << " batches";
  }

  return ss.str();
}
// Depending on the number of non-converging batches,
// format the non-converging batches string as either (no leading or trailing whitespaces)
// batches 2, 3, 5  // or
// batches 2, 3, 5, 7, 11 and other 65535 batches
Depending on the number of non-converging batches,
format the non-converging batches string as either (no leading or trailing whitespaces)
batches 2, 3, 5  // or
batches 2, 3, 5, 7, 11 and other 65535 batches
Depending on the number of non - converging batches format the non - converging batches string as either ( no leading or trailing whitespaces ) batches 2 3 5 // or batches 2 3 5 7 11 and other 65535 batches
std::string _format_non_converging_batches(const std::vector<int64_t>& batches) {
  std::stringstream ss;
  const int too_long = 5;
  ss << "batches ";
  if (batches.size() <= too_long) {
    for (const auto i : c10::irange(batches.size() - 1)) {
      ss << batches[i] << ", ";
    }
    ss << batches.back();
  } else {
    for (const auto i : c10::irange(too_long)) {
      ss << batches[i] << ", ";
    }
    ss << "and other " << batches.size() - too_long << " batches";
  }
  return ss.str();
}
std :: string _format_non_converging_batches ( const std :: vector < int64_t > & batches ) { std :: stringstream ss ; const int too_long = 5 ; ss << " " ; if ( batches . size ( ) <= too_long ) { for ( const auto i : c10 :: irange ( batches . size ( ) - 1 ) ) { ss << batches [ i ] << " " ; } ss << batches . back ( ) ; } else { for ( const auto i : c10 :: irange ( too_long ) ) { ss << batches [ i ] << " " ; } ss << " " << batches . size ( ) - too_long << " " ; } return ss . str ( ) ; }
Depending on the number of non-converging batches,
format the non-converging batches string as either (no leading or trailing whitespaces)
batches 2, 3, 5  // or
batches 2, 3, 5, 7, 11 and other 65535 batches
Depending on the number of non - converging batches format the non - converging batches string as either ( no leading or trailing whitespaces ) batches 2 3 5 // or batches 2 3 5 7 11 and other 65535 batches