Beispiel #1
0
	void layer::check_layer_data_consistency(const layer_data& data) const
	{
		data_config dc = get_data_config();
		if (dc.size() != data.size())
			throw neural_network_exception((boost::format("data weight vector count %1% doesn't satisfy layer configuration %2%") % data.size() % dc.size()).str());
		for(unsigned int i = 0; i < dc.size(); ++i)
		{
			if (dc[i] != data[i].size())
				throw neural_network_exception((boost::format("data weight count %1% for vector %2% doesn't satisfy layer configuration %3%") % data[i].size() % i % dc[i]).str());
		}
	}
Beispiel #2
0
	layer_data_smart_ptr layer::create_layer_data() const
	{
		layer_data_smart_ptr res(new layer_data());

		data_config dc = get_data_config();
		res->resize(dc.size());
		for(unsigned int i = 0; i < dc.size(); ++i)
			(*res)[i].resize(dc[i]);

		return res;
	}
Beispiel #3
0
	bool layer::is_empty_data() const
	{
		data_config dc = get_data_config();

		for(std::vector<unsigned int>::const_iterator it = dc.begin(); it != dc.end(); it++)
		{
			if (*it > 0)
				return false;
		}

		return true;
	}
Beispiel #4
0
	bool layer::is_empty_data() const
	{
		return get_data_config().empty();
	}