#include "keras_model.h"
Definition at line 192 of file keras_model.h.
keras::LayerConv2D::LayerConv2D |
( |
| ) |
|
|
inline |
Implements keras::Layer.
Definition at line 323 of file keras_model.cc.
References keras::conv_single_depth_same(), keras::conv_single_depth_valid(), keras::DataChunk::get_3d(), keras::DataChunk2D::get_3d_rw(), util::size(), x, and y.
325 unsigned int st_x = (
m_kernels[0][0].size() - 1) >> 1;
326 unsigned int st_y = (
m_kernels[0][0][0].size() - 1) >> 1;
327 auto const& im = dc->
get_3d();
329 size_t size_x = (
m_border_mode ==
"valid") ? im[0].
size() - 2 * st_x : im[0].size();
330 size_t size_y = (
m_border_mode ==
"valid") ? im[0][0].
size() - 2 * st_y : im[0][0].size();
339 tbb::parallel_for(
size_t(0),
size_t(
m_kernels.size()), [&](
size_t j) {
340 for (
unsigned int m = 0; m < im.size(); ++m) {
347 for (
unsigned int x = 0;
x < y_ret[0].size(); ++
x) {
349 size_t size = y_ret[0][0].size();
353 for (
unsigned int y = 0;
y < size / 8; ++
y) {
354 y_ret[j][
x][k] += bias;
355 y_ret[j][
x][k + 1] += bias;
356 y_ret[j][
x][k + 2] += bias;
357 y_ret[j][
x][k + 3] += bias;
358 y_ret[j][
x][k + 4] += bias;
359 y_ret[j][
x][k + 5] += bias;
360 y_ret[j][
x][k + 6] += bias;
361 y_ret[j][
x][k + 7] += bias;
365 y_ret[j][
x][k] += bias;
std::vector< std::vector< std::vector< std::vector< float > > > > m_kernels
virtual std::vector< std::vector< std::vector< float > > > const & get_3d() const
void conv_single_depth_same(std::vector< std::vector< float >> &y, std::vector< std::vector< float >> const &im, std::vector< std::vector< float >> const &k)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
std::vector< float > m_bias
void conv_single_depth_valid(std::vector< std::vector< float >> &y, std::vector< std::vector< float >> const &im, std::vector< std::vector< float >> const &k)
std::string m_border_mode
std::vector< std::vector< std::vector< float > > > & get_3d_rw()
virtual unsigned int keras::LayerConv2D::get_input_cols |
( |
| ) |
const |
|
inlinevirtual |
virtual unsigned int keras::LayerConv2D::get_input_rows |
( |
| ) |
const |
|
inlinevirtual |
std::string keras::Layer::get_name |
( |
| ) |
|
|
inlineinherited |
virtual unsigned int keras::LayerConv2D::get_output_units |
( |
| ) |
const |
|
inlinevirtual |
void keras::LayerConv2D::load_weights |
( |
std::ifstream & |
fin | ) |
|
|
virtual |
Implements keras::Layer.
Definition at line 40 of file keras_model.cc.
References d, and r.
47 if (m_border_mode ==
"[") {
48 m_border_mode =
"valid";
53 <<
" border_mode " << m_border_mode << endl;
56 vector<vector<vector<float>>> tmp_depths;
58 vector<vector<float>> tmp_single_depth;
60 if (!skip) {
fin >> tmp_char; }
64 vector<float> tmp_row;
65 for (
int c = 0; c <
m_cols; ++c) {
68 tmp_row.push_back(tmp_float);
71 tmp_single_depth.push_back(tmp_row);
73 tmp_depths.push_back(tmp_single_depth);
81 m_bias.push_back(tmp_float);
std::vector< std::vector< std::vector< std::vector< float > > > > m_kernels
std::vector< float > m_bias
std::string m_border_mode
std::vector<float> keras::LayerConv2D::m_bias |
std::string keras::LayerConv2D::m_border_mode |
int keras::LayerConv2D::m_cols |
int keras::LayerConv2D::m_depth |
std::vector<std::vector<std::vector<std::vector<float> > > > keras::LayerConv2D::m_kernels |
int keras::LayerConv2D::m_kernels_cnt |
std::string keras::Layer::m_name |
|
inherited |
int keras::LayerConv2D::m_rows |
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