<commit_before>#ifndef SHADOW_UTIL_UTIL_HPP
#define SHADOW_UTIL_UTIL_HPP

#include <algorithm>
#include <cfloat>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <sstream>
#include <string>
#include <vector>

const float EPS = 0.001f;

template <class Dtype>
class Point {
 public:
  Point() {}
  Point(Dtype x_t, Dtype y_t, float score_t = -1)
      : x(x_t), y(y_t), score(score_t) {}
  Dtype x, y;
  float score;
};

template <class Dtype>
class Rect {
 public:
  Rect() {}
  Rect(Dtype x_t, Dtype y_t, Dtype w_t, Dtype h_t)
      : x(x_t), y(y_t), w(w_t), h(h_t) {}
  Dtype x, y, w, h;
};

template <class Dtype>
class Size {
 public:
  Size() {}
  Size(Dtype w_t, Dtype h_t) : w(w_t), h(h_t) {}
  Dtype w, h;
};

typedef Point<float> Point2f;
typedef Point<int> Point2i;
typedef Rect<float> RectF;
typedef Rect<int> RectI;
typedef Size<float> SizeF;
typedef Size<int> SizeI;

typedef std::vector<Point2f> VecPoint2f;
typedef std::vector<Point2i> VecPoint2i;
typedef std::vector<RectF> VecRectF;
typedef std::vector<RectI> VecRectI;
typedef std::vector<SizeF> VecSizeF;
typedef std::vector<SizeI> VecSizeI;

typedef std::vector<float> VecFloat;
typedef std::vector<int> VecInt;
typedef std::list<float> ListFloat;
typedef std::list<int> ListInt;

#if defined(USE_GLog)
#ifndef __linux__
#define GOOGLE_GLOG_DLL_DECL
#endif
#include <glog/logging.h>

#define Info(msg) \
  { LOG(INFO) << msg; }

#define Warning(msg) \
  { LOG(WARNING) << msg; }

#define Error(msg) \
  { LOG(ERROR) << msg; }

#define Fatal(msg) \
  { LOG(FATAL) << msg; }

#else
#define Info(msg) \
  { std::cout << __FILE__ << ":" << __LINE__ << " Info: " << msg << std::endl; }

#define Warning(msg)                                                \
  {                                                                 \
    std::cerr << __FILE__ << ":" << __LINE__ << " Warning: " << msg \
              << std::endl;                                         \
  }

#define Fatal(msg)                                                \
  {                                                               \
    std::cerr << __FILE__ << ":" << __LINE__ << " Fatal: " << msg \
              << std::endl;                                       \
    exit(1);                                                      \
  }
#endif

namespace Util {

inline float rand_uniform(float min, float max) {
  return (static_cast<float>(std::rand()) / RAND_MAX) * (max - min) + min;
}
<commit_msg>add round in util<commit_after>#ifndef SHADOW_UTIL_UTIL_HPP
#define SHADOW_UTIL_UTIL_HPP

#include <algorithm>
#include <cfloat>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <sstream>
#include <string>
#include <vector>

const float EPS = 0.001f;

template <class Dtype>
class Point {
 public:
  Point() {}
  Point(Dtype x_t, Dtype y_t, float score_t = -1)
      : x(x_t), y(y_t), score(score_t) {}
  Dtype x, y;
  float score;
};

template <class Dtype>
class Rect {
 public:
  Rect() {}
  Rect(Dtype x_t, Dtype y_t, Dtype w_t, Dtype h_t)
      : x(x_t), y(y_t), w(w_t), h(h_t) {}
  Dtype x, y, w, h;
};

template <class Dtype>
class Size {
 public:
  Size() {}
  Size(Dtype w_t, Dtype h_t) : w(w_t), h(h_t) {}
  Dtype w, h;
};

typedef Point<float> Point2f;
typedef Point<int> Point2i;
typedef Rect<float> RectF;
typedef Rect<int> RectI;
typedef Size<float> SizeF;
typedef Size<int> SizeI;

typedef std::vector<Point2f> VecPoint2f;
typedef std::vector<Point2i> VecPoint2i;
typedef std::vector<RectF> VecRectF;
typedef std::vector<RectI> VecRectI;
typedef std::vector<SizeF> VecSizeF;
typedef std::vector<SizeI> VecSizeI;

typedef std::vector<float> VecFloat;
typedef std::vector<int> VecInt;
typedef std::list<float> ListFloat;
typedef std::list<int> ListInt;

#if defined(USE_GLog)
#ifndef __linux__
#define GOOGLE_GLOG_DLL_DECL
#endif
#include <glog/logging.h>

#define Info(msg) \
  { LOG(INFO) << msg; }

#define Warning(msg) \
  { LOG(WARNING) << msg; }

#define Error(msg) \
  { LOG(ERROR) << msg; }

#define Fatal(msg) \
  { LOG(FATAL) << msg; }

#else
#define Info(msg) \
  { std::cout << __FILE__ << ":" << __LINE__ << " Info: " << msg << std::endl; }

#define Warning(msg)                                                \
  {                                                                 \
    std::cerr << __FILE__ << ":" << __LINE__ << " Warning: " << msg \
              << std::endl;                                         \
  }

#define Fatal(msg)                                                \
  {                                                               \
    std::cerr << __FILE__ << ":" << __LINE__ << " Fatal: " << msg \
              << std::endl;                                       \
    exit(1);                                                      \
  }
#endif

namespace Util {

template <typename Dtype>
inline int round(Dtype x) {
  return static_cast<int>(std::floor(x + 0.5));
}

inline float rand_uniform(float min, float max) {
  return (static_cast<float>(std::rand()) / RAND_MAX) * (max - min) + min;
}

{'fraction_non_alphanumeric': 0.14795218498922202, 'fraction_numerical': 0.005095042132079169, 'mean_word_length': 2.2655150351887396, 'pattern_counts': {'":': 6, '<': 155, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2098363', 'n_tokens_mistral': 1860, 'n_tokens_neox': 1764, 'n_words': 421}