Skip to content

Instantly share code, notes, and snippets.

View terasakisatoshi's full-sized avatar

Satoshi Terasaki terasakisatoshi

View GitHub Profile
@terasakisatoshi
terasakisatoshi / Playing_ChainerCV_in_advance.ipynb
Created March 21, 2018 05:37
playing_chainercv_in_advance
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@terasakisatoshi
terasakisatoshi / callpywithpybind11.cpp
Created March 29, 2018 07:57
call python from C++ with pybind11
#include <pybind11/embed.h> // everything needed for embedding
#include <iostream>
namespace py = pybind11;
void say_hello() {
py::print("Hello, World!"); // use the Python API
}
void exec_py_code() {
@terasakisatoshi
terasakisatoshi / matmul.ipynb
Created May 6, 2018 11:54
arraymancer experiments
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@terasakisatoshi
terasakisatoshi / mnist_slim.py
Created June 14, 2018 04:52
tensorflow slim example
"""
Exercise for tensorflow.contrib.slim
model Reference:http://arakan-pgm-ai.hatenablog.com/entry/2017/11/23/080000
"""
import tensorflow as tf
import tensorflow.contrib.slim as slim
from tensorflow.examples.tutorials.mnist import input_data
from contextlib import ExitStack
"""
Main Reference:
https://qiita.com/ceptree/items/c547116bda4a5db11596
"""
import numpy as np
from matplotlib import pyplot as plt
def update(event_hanlder):
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@terasakisatoshi
terasakisatoshi / PCA_with_iris.ipynb
Created July 29, 2018 14:07
compare result between scratch and library
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@terasakisatoshi
terasakisatoshi / triangle.py
Created August 11, 2018 20:44
三角関数の加法定理の視覚化
"""
Usage:
$ pip install bokeh
$ bokeh serve --show triangle.py
Then your web browser starts. Enjoy!
"""
import math
import numpy as np
@terasakisatoshi
terasakisatoshi / call_py_c_from_julia.jl
Created August 13, 2018 01:53
JuliaからPython,Cを呼ぶ。
# https://www.juliabox.com/notebook/notebooks/tutorials/intro-to-julia/09.%20Julia%20is%20fast.ipynb
using PyCall
using Libdl
py"""
def pysum(arr):
s=0
for a in arr:
s+=a
@terasakisatoshi
terasakisatoshi / easy_exer.jl
Created August 13, 2018 02:45
ベンチマーク練習
using InteractiveUtils
using BenchmarkTools
using PyCall
versioninfo()
a = rand(10^7) # 1D vector of random numbers, uniform on [0,1)
function mysum(arr)
s = 0.0