21 #ifndef SNABSUITE_SNABS_MNIST_HPP 22 #define SNABSUITE_SNABS_MNIST_HPP 24 #include <cypress/cypress.hpp> 39 virtual cypress::Network &build_netw(cypress::Network &
netw)
override;
40 virtual void run_netw(cypress::Network &netw)
override;
41 virtual std::vector<std::array<cypress::Real, 4>> evaluate()
override;
51 cypress::Real m_duration, m_max_freq,
63 std::pair<std::vector<std::vector<Real>>, std::vector<uint16_t>>>
66 bool m_batch_parallel =
true;
68 std::vector<cypress::Network>
73 std::string m_dnn_file =
"";
74 bool m_scaled_image =
false;
75 std::shared_ptr<MNIST::MLPBase>
m_mlp;
77 cypress::Real m_weights_scale_factor = 0.0;
80 bool m_count_spikes =
false;
91 size_t create_deep_network(cypress::Network &netw, Real
max_weight = 0.0,
92 Real max_pool_weight = 0.0,
93 Real pool_inhib_weight = 0.0);
102 MNIST_BASE(
const std::string backend,
size_t bench_index, std::string name);
116 cypress::Network &build_netw_int(cypress::Network &netw);
131 std::shared_ptr<SNABBase>
clone()
override 133 return std::make_shared<MnistSpikey>(m_backend, m_bench_index);
149 std::shared_ptr<SNABBase>
clone()
override 151 return std::make_shared<MnistNAS63>(m_backend, m_bench_index);
167 std::shared_ptr<SNABBase>
clone()
override 169 return std::make_shared<MnistNAS129>(m_backend, m_bench_index);
185 std::shared_ptr<SNABBase>
clone()
override 187 return std::make_shared<MnistNAStop>(m_backend, m_bench_index);
205 std::shared_ptr<SNABBase>
clone()
override 207 return std::make_shared<MnistDiehl>(m_backend, m_bench_index);
222 virtual cypress::Network &build_netw(cypress::Network &
netw)
override;
223 virtual void run_netw(cypress::Network &netw)
override;
224 virtual std::vector<std::array<cypress::Real, 4>> evaluate()
override;
226 virtual std::shared_ptr<SNABBase>
clone()
override 228 return std::make_shared<MnistITLLastLayer>(m_backend, m_bench_index);
237 std::pair<std::vector<std::vector<std::vector<Real>>>,
238 std::vector<uint16_t>>
241 bool m_positive =
false;
242 cypress::Real m_norm_rate_hidden = 1.0;
243 cypress::Real m_norm_rate_last = 1.0;
244 size_t m_global_correct = 0;
245 size_t m_num_images = 0;
246 cypress::Real m_sim_time = 0;
247 std::string m_loss_function =
"CatHinge";
248 bool m_last_layer_only =
true;
249 size_t m_num_test_images = 10000;
250 size_t m_test_batchsize = 0;
263 m_last_layer_only =
false;
265 std::shared_ptr<SNABBase>
clone()
override 267 return std::make_shared<MnistITL>(m_backend, m_bench_index);
286 std::shared_ptr<SNABBase>
clone()
override 288 return std::make_shared<MnistDoubleCNN>(m_backend, m_bench_index);
308 std::shared_ptr<SNABBase>
clone()
override 310 return std::make_shared<MnistCNNPool>(m_backend, m_bench_index);
MnistNAS129(const std::string backend, size_t bench_index)
MnistDoubleCNN(const std::string backend, size_t bench_index)
std::shared_ptr< SNABBase > clone() override
Virtual method cloning the SNAB without knowing which SNAB it is.
std::shared_ptr< MNIST::MLPBase > m_mlp
std::shared_ptr< SNABBase > clone() override
Virtual method cloning the SNAB without knowing which SNAB it is.
MnistITL(const std::string backend, size_t bench_index)
std::vector< cypress::Network > m_networks
std::shared_ptr< SNABBase > clone() override
Virtual method cloning the SNAB without knowing which SNAB it is.
MnistCNNPool(const std::string backend, size_t bench_index)
MnistSpikey(const std::string backend, size_t bench_index)
std::vector< cypress::PopulationBase > m_label_pops
MnistNAS63(const std::string backend, size_t bench_index)
cypress::Real m_pool_inhib_weight
cypress::Real m_max_weight
cypress::Json read_config(const std::string &name, const std::string &backend)
Virtual Base class for SNABs(Benchmarks). All SNABs should have seperate building of networks...
MnistDiehl(const std::string backend, size_t bench_index)
std::shared_ptr< SNABBase > clone() override
Virtual method cloning the SNAB without knowing which SNAB it is.
std::vector< cypress::PopulationBase > m_all_pops
std::vector< cypress::Real > m_conv_weights_scale_factors
std::shared_ptr< SNABBase > clone() override
Virtual method cloning the SNAB without knowing which SNAB it is.
MnistITLLastLayer(const std::string backend, size_t bench_index)
virtual std::shared_ptr< SNABBase > clone() override
Virtual method cloning the SNAB without knowing which SNAB it is.
std::shared_ptr< SNABBase > clone() override
Virtual method cloning the SNAB without knowing which SNAB it is.
Real max_weight(const T &json)
Calculate the max weight, ignore negative values.
cypress::Real m_max_pool_weight
std::string m_neuron_type_str
std::pair< std::vector< std::vector< std::vector< Real > > >, std::vector< uint16_t > > m_spmnist
cypress::Real m_pool_delay
MnistITLLastLayer(const std::string backend, size_t bench_index, std::string name)
std::shared_ptr< SNABBase > clone() override
Virtual method cloning the SNAB without knowing which SNAB it is.
std::vector< std::pair< std::vector< std::vector< Real > >, std::vector< uint16_t > > > m_batch_data
MnistNAStop(const std::string backend, size_t bench_index)
NeuronParameter m_neuro_params
std::shared_ptr< SNABBase > clone() override
Virtual method cloning the SNAB without knowing which SNAB it is.