#include "keras_model.h"
Definition at line 158 of file keras_model.h.
keras::LayerMaxPooling::LayerMaxPooling |
( |
| ) |
|
|
inline |
Implements keras::Layer.
Definition at line 149 of file keras_model.cc.
References d, keras::DataChunk::get_3d(), util::size(), util::values(), x, and y.
151 vector<vector<vector<float>>> im = dc->
get_3d();
152 vector<vector<vector<float>>> y_ret;
153 for (
unsigned int i = 0; i < im.size(); ++i) {
154 vector<vector<float>> tmp_y;
155 for (
unsigned int j = 0; j < (
unsigned int)(im[0].
size() /
m_pool_x); ++j) {
156 tmp_y.push_back(vector<float>((
int)(im[0][0].
size() /
m_pool_y), 0.0));
158 y_ret.push_back(tmp_y);
160 for (
unsigned int d = 0;
d < y_ret.size(); ++
d) {
161 for (
unsigned int x = 0;
x < y_ret[0].size(); ++
x) {
163 unsigned int end_x = start_x +
m_pool_x;
164 for (
unsigned int y = 0;
y < y_ret[0][0].size(); ++
y) {
166 unsigned int end_y = start_y +
m_pool_y;
169 for (
unsigned int i = start_x; i < end_x; ++i) {
170 for (
unsigned int j = start_y; j < end_y; ++j) {
171 values.push_back(im[
d][i][j]);
174 y_ret[
d][
x][
y] = *max_element(values.begin(), values.end());
179 out->set_data(y_ret);
virtual std::vector< std::vector< std::vector< float > > > const & get_3d() const
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
decltype(auto) values(Coll &&coll)
Range-for loop helper iterating across the values of the specified collection.
virtual unsigned int keras::LayerMaxPooling::get_input_cols |
( |
| ) |
const |
|
inlinevirtual |
virtual unsigned int keras::LayerMaxPooling::get_input_rows |
( |
| ) |
const |
|
inlinevirtual |
std::string keras::Layer::get_name |
( |
| ) |
|
|
inlineinherited |
virtual unsigned int keras::LayerMaxPooling::get_output_units |
( |
| ) |
const |
|
inlinevirtual |
void keras::LayerMaxPooling::load_weights |
( |
std::ifstream & |
fin | ) |
|
|
virtual |
std::string keras::Layer::m_name |
|
inherited |
int keras::LayerMaxPooling::m_pool_x |
int keras::LayerMaxPooling::m_pool_y |
The documentation for this class was generated from the following files:
- larrecodnn/v09_23_00/source/larrecodnn/ImagePatternAlgs/Keras/keras_model.h
- larrecodnn/v09_23_00/source/larrecodnn/ImagePatternAlgs/Keras/keras_model.cc