diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e6f3c35..44bd36eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## HEAD +## 1.3.0 - 2023-01-24 ### Features diff --git a/third_party/boost/workspace.bzl b/third_party/boost/workspace.bzl index 38fa269b..63344855 100644 --- a/third_party/boost/workspace.bzl +++ b/third_party/boost/workspace.bzl @@ -2,7 +2,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository") -def deps(prefix = ""): +def deps(prefix = "", from_git_repo = True): branch = "boost-1.75.0" # branch = "master" # branch = "develop" @@ -20,30 +20,32 @@ cc_library( ) """ - new_git_repository( - name = "org_boost", - branch = branch, - build_file_content = build_file_content, - init_submodules = True, - recursive_init_submodules = True, - remote = "https://github.com/boostorg/boost", - ) + if from_git_repo: + new_git_repository( + name = "org_boost", + branch = branch, + build_file_content = build_file_content, + init_submodules = True, + recursive_init_submodules = True, + remote = "https://github.com/boostorg/boost", + ) - # Bazel has a 10 minutes timeout on most commands. If getting Boost - # times-out (boost is composed of many sub repositories), do the following: - # - # PS: Make sure this is not your anti-virus that is slowing things down. - # - # 1. Create a new directory in your homespace (e.g. "dependencies"). - # 2. Open a shell in this directory and run: - # git clone --branch boost-1.75.0 https://github.com/boostorg/boost.git - # cd boost - # git submodule update --init --checkout --force - # 3. Comment the "new_git_repository" rule above, and uncomment the - # "new_local_repository" rule below. + else: + # Bazel has a 10 minutes timeout on most commands. If getting Boost + # times-out (boost is composed of many sub repositories), do the following: + # + # PS: Make sure this is not your anti-virus that is slowing things down. + # + # 1. Create a new directory in your homespace (e.g. "dependencies"). + # 2. Open a shell in this directory and run: + # git clone --branch boost-1.75.0 https://github.com/boostorg/boost.git + # cd boost + # git submodule update --init --checkout --force + # 3. Comment the "new_git_repository" rule above, and uncomment the + # "new_local_repository" rule below. - # native.new_local_repository( - # name = "org_boost", - # path = "../boost", - # build_file_content = build_file_content, - # ) + native.new_local_repository( + name = "org_boost", + path = "../boost", + build_file_content = build_file_content, + ) diff --git a/yggdrasil_decision_forests/serving/example_set.cc b/yggdrasil_decision_forests/serving/example_set.cc index fa319272..85141da5 100644 --- a/yggdrasil_decision_forests/serving/example_set.cc +++ b/yggdrasil_decision_forests/serving/example_set.cc @@ -125,8 +125,9 @@ FeaturesDefinitionNumericalOrCategoricalFlat::unstacked_features() const { bool FeaturesDefinitionNumericalOrCategoricalFlat::HasInputFeature( const absl::string_view name) const { - return feature_def_cache_.find(name) != feature_def_cache_.end() || - indexed_unstacked_features_.find(name) != + return feature_def_cache_.find(std::string(name)) != + feature_def_cache_.end() || + indexed_unstacked_features_.find(std::string(name)) != indexed_unstacked_features_.end(); } diff --git a/yggdrasil_decision_forests/serving/example_set.h b/yggdrasil_decision_forests/serving/example_set.h index e231488c..5be9834f 100644 --- a/yggdrasil_decision_forests/serving/example_set.h +++ b/yggdrasil_decision_forests/serving/example_set.h @@ -66,6 +66,7 @@ #include #include #include +#include #include #include @@ -219,7 +220,7 @@ class FeaturesDefinitionNumericalOrCategoricalFlat { // is not used by the model as input. absl::StatusOr FindFeatureDefByName( const absl::string_view name) const { - auto cached_feature_it = feature_def_cache_.find(name); + auto cached_feature_it = feature_def_cache_.find(std::string(name)); if (cached_feature_it != feature_def_cache_.end()) { // The feature was found. return cached_feature_it->second; @@ -255,7 +256,7 @@ class FeaturesDefinitionNumericalOrCategoricalFlat { // Gets the unstacked feature definition from its name. absl::StatusOr FindUnstackedFeatureDefByName( const absl::string_view name) const { - auto it_index = indexed_unstacked_features_.find(name); + auto it_index = indexed_unstacked_features_.find(std::string(name)); if (it_index == indexed_unstacked_features_.end()) { return absl::InvalidArgumentError( absl::Substitute("Unknown unstacked feature $0", name)); @@ -339,7 +340,7 @@ class FeaturesDefinitionNumericalOrCategoricalFlat { absl::StatusOr GetMultiDimNumericalFeatureId( const absl::string_view name) const { // Get the unstacked feature information. - const auto it_index = indexed_unstacked_features_.find(name); + const auto it_index = indexed_unstacked_features_.find(std::string(name)); if (it_index == indexed_unstacked_features_.end()) { return absl::InvalidArgumentError( absl::StrFormat("Unknown feature %s", name)); @@ -419,13 +420,13 @@ class FeaturesDefinitionNumericalOrCategoricalFlat { // Index to the "fixed_length_features_" and "categorical_set_features_" by // "name". - absl::flat_hash_map feature_def_cache_; + std::unordered_map feature_def_cache_; // List of "unstacked" features (similar to "unstackeds" in the dataspec). std::vector unstacked_features_; // Index "original name" to its index in "unstacked_features_". - absl::flat_hash_map indexed_unstacked_features_; + std::unordered_map indexed_unstacked_features_; }; using FeaturesDefinition = FeaturesDefinitionNumericalOrCategoricalFlat;