Пример #1
0
	bool layer_factory::register_layer(layer::const_ptr sample_layer)
	{
		std::string type_name = sample_layer->get_type_name();
		std::transform(type_name.begin(), type_name.end(), type_name.begin(), ::tolower);
		sample_name_id_map.insert(std::make_pair(type_name, static_cast<unsigned int>(sample_name_id_map.size())));
		return sample_name_layer_map.insert(std::make_pair(type_name, sample_layer)).second;
	}
		layer_testing_schema::ptr layer_testing_schema_factory::create_testing_schema_layer(
			layer::const_ptr layer,
			cuda_running_configuration::const_ptr cuda_config) const
		{
			sample_map::const_iterator i = sample_layer_testing_schema_map.find(layer->get_type_name());

			if (i == sample_layer_testing_schema_map.end())
				throw neural_network_exception((boost::format("No CUDA layer testing schema is registered with type name %1%") % layer->get_type_name()).str());

			return i->second->create(
				layer,
				cuda_config);
		}