#ifndef __APP_CONTEXT_H__
#define __APP_CONTEXT_H__
+#include <algorithm>
#include <functional>
#include <memory>
#include <mutex>
auto &str_map = std::get<StrIndexType<T>>(index);
auto &int_map = std::get<IntIndexType>(index);
- const std::string &assigned_key = key == "" ? factory({})->getType() : key;
+ std::string assigned_key = key == "" ? factory({})->getType() : key;
+
+ std::transform(assigned_key.begin(), assigned_key.end(),
+ assigned_key.begin(),
+ [](unsigned char c) { return std::tolower(c); });
const std::lock_guard<std::mutex> lock(factory_mutex);
if (str_map.find(assigned_key) != str_map.end()) {
auto &index = std::get<IndexType<T>>(factory_map);
auto &str_map = std::get<StrIndexType<T>>(index);
- const auto &entry = str_map.find(key);
+ std::string lower_key;
+ lower_key.resize(key.length());
+
+ std::transform(key.begin(), key.end(), lower_key.begin(),
+ [](unsigned char c) { return std::tolower(c); });
+
+ const auto &entry = str_map.find(lower_key);
if (entry == str_map.end()) {
std::stringstream ss;
- ss << "Key is not found for the object. Key: " << key;
+ ss << "Key is not found for the object. Key: " << lower_key;
throw exception::not_supported(ss.str().c_str());
}
#include <optimizer.h>
/**
- * @brief Neural Network Model Contruct Test
+ * @brief Neural Network Model Construct Test
*/
TEST(ccapi_model, construct_01_n) {
EXPECT_THROW(ml::train::createModel(ml::train::ModelType::UNKNOWN),
}
/**
- * @brief Neural Network Model Contruct Test
+ * @brief Neural Network Model Construct Test
*/
TEST(ccapi_model, construct_02_p) {
EXPECT_NO_THROW(ml::train::createModel(ml::train::ModelType::NEURAL_NET));
}
/**
- * @brief Neural Network Layer Contruct Test
+ * @brief Neural Network Layer Construct Test
*/
TEST(ccapi_layer, construct_01_n) {
EXPECT_THROW(ml::train::createLayer("unknown type"), std::invalid_argument);