Skip to content

Instantly share code, notes, and snippets.

View marty1885's full-sized avatar
πŸ‘¨β€πŸ’»
Writing code

Martin Chang marty1885

πŸ‘¨β€πŸ’»
Writing code
View GitHub Profile
────────────────────────────────────────────────────────────────────────────────
Layer (type) Output shape Params #
================================================================================
input_1 (input) {None, 784} 0
────────────────────────────────────────────────────────────────────────────────
STDP_1 (STDP) {None, 30} 23520
────────────────────────────────────────────────────────────────────────────────
tanh_1 (tanh) {None, 30} 0
//#define DISP_WEIGHT
#include <Athena/Athena.hpp>
#include <Athena/XtensorBackend.hpp>
#include <Athena/NNPACKBackend.hpp>
#include "mnist_reader.hpp"
//Need to use xtensor API due to incomplete Tensor implementation
#include "csv.h"
#include <Athena/Athena.hpp>
#include <Athena/XtensorBackend.hpp>
#include <iostream>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#pragma once
#include <Athena/Athena.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <random>
#include <termios.h>
#include <stdio.h>
static struct termios old, new;
/* Initialize new terminal i/o settings */
void initTermios(int echo)
{
tcgetattr(0, &old); /* grab old terminal i/o settings */
new = old; /* make new settings same as old settings */
@marty1885
marty1885 / clinfo
Created March 17, 2018 06:28
clinfo
Number of platforms 2
Platform Name NVIDIA CUDA
Platform Vendor NVIDIA Corporation
Platform Version OpenCL 1.2 CUDA 9.1.84
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts cl_nv_create_buffer
Platform Extensions function suffix NV
Platform Name Intel(R) OpenCL
Platform Vendor Intel(R) Corporation
/opt/cuda/extras/demo_suite/deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce GTX 970"
CUDA Driver Version / Runtime Version 9.1 / 9.1
CUDA Capability Major/Minor version number: 5.2
Total amount of global memory: 4035 MBytes (4230938624 bytes)
xt::xarray<float> X = xt::read_npy<float>("X.npy");
xt::xarray<float> X = xt::load_npy<float>("X.npy");
xt::xarray<float> Y = xt::cast<float>((xt::xarray<float>)xt::load_npy<double>("Y.npy"));
network<sequential> net;
net << conv(64, 64, 5, 1, 6) << leaky_relu() // in: 64x64x1, out 6 chanels, kernel size: 5
<< max_pool(60, 60, 6, 2) // in: 60x60x6, 2x2 pooling
<< conv(30, 30, 5, 6, 9) << leaky_relu() // in: 30x30x6, out 9 channels, kernel size: 5
<< max_pool(26, 26, 9, 2) // in:26x26x9, 2x2 pooling
<< conv(13, 13, 6, 9, 12) << leaky_relu()// in: 13x13x9, out 12 channels, kernel size: 6
<< fc(8*8*12, 10)
<< softmax();
adam optimizer;
net.train<mse>(optimizer, x, y, BATCH_SIZE, NUM_BATCHES