SNABSuite  0.x
Spiking Neural Architecture Benchmark Suite
Public Member Functions | Public Attributes | List of all members
MNIST::PositiveLimitedWeights Class Reference

#include <mnist_mlp.hpp>

Public Member Functions

void setup (std::vector< cypress::Matrix< Real >> &layers)
 
void constrain_weights (std::vector< cypress::Matrix< Real >> &layers)
 

Public Attributes

Real m_max = 0.0
 

Detailed Description

Definition at line 163 of file mnist_mlp.hpp.

Member Function Documentation

void MNIST::PositiveLimitedWeights::constrain_weights ( std::vector< cypress::Matrix< Real >> &  layers)
inline

Definition at line 176 of file mnist_mlp.hpp.

177  {
178  for (auto &i : layers) {
179  for (auto &j : i) {
180  if (j < 0.0) {
181  j = 0.0;
182  }
183  if (j > m_max) {
184  j = m_max;
185  }
186  }
187  }
188  }
void MNIST::PositiveLimitedWeights::setup ( std::vector< cypress::Matrix< Real >> &  layers)
inline

Definition at line 167 of file mnist_mlp.hpp.

168  {
169  for (auto &layer : layers) {
170  auto w = mnist_helper::max_weight(layer);
171  if (w > m_max)
172  m_max = w;
173  }
174  }
Real max_weight(const T &json)
Calculate the max weight, ignore negative values.

Member Data Documentation

Real MNIST::PositiveLimitedWeights::m_max = 0.0

Definition at line 165 of file mnist_mlp.hpp.


The documentation for this class was generated from the following file: