Skip to content

Instantly share code, notes, and snippets.

View sasagawa888's full-sized avatar

kenichi sasagawa sasagawa888

View GitHub Profile
defmodule Midi do
@moduledoc """
Documentation for `Midi`.
"""
@doc """
Tarai function music.
## Examples
# for CNN test for Fashion-MNIST
defnetwork init_network9(_x) do
_x
# |> visualizer(1,1)
|> f(5, 5, 1, 12, {1, 1}, 1, 0.1, 0.001)
|> pooling(2, 2)
|> f(3, 3, 12, 12, {1, 1}, 1, 0.1, 0.001)
|> f(2, 2, 12, 12, {1, 1}, 1, 0.1, 0.001)
|> pooling(2, 2)
|> f(3, 3, 12, 12, {1, 1}, 0, 0.1, 0.001)
# for CNN test for Fashion-MNIST
defnetwork init_network9(_x) do
_x
# |> visualizer(1,1)
|> f(5, 5, 1, 12, {1, 1}, 1, 0.1, 0.001)
|> pooling(2, 2)
|> f(3, 3, 12, 12, {1, 1}, 1, 0.1, 0.001)
|> f(2, 2, 12, 12, {1, 1}, 1, 0.1, 0.001)
|> pooling(2, 2)
|> f(3, 3, 12, 12, {1, 1}, 0, 0.1, 0.001)
Elxlog ver0.05
?- X is elx_tarai(12,6,0).
X = 12
true
?-
def tarai(x, y, z) do
cond do
x <= y -> y
true -> tarai(tarai(x - 1, y, z), tarai(y - 1, z, x), tarai(z - 1, x, y))
tarai(X,Y,_,Y):-
X=<Y,!.
tarai(X,Y,Z,R):-
X1 is X-1,Y1 is Y-1,Z1 is Z-1,
tarai(X1,Y,Z,R1),tarai(Y1,Z,X,R2),tarai(Z1,X,Y,R3),tarai(R1,R2,R3,R).
# for adagrad test
defnetwork init_network4(_x) do
_x |> f(10,10) |> flatten
|> w(361,300) |> b(300) |> relu
|> w(300,100) |> b(100) |> relu
|> w(100,10) |> b(10) |> softmax
end
def all(m,n) do
IO.puts("preparing data")
@sasagawa888
sasagawa888 / gist:9b1f35ed0319600dc6fa
Created February 28, 2016 06:15
Preprocessor for Meta-expression
;;Sapphire preprocessor
;;Meta-language
(define tokens '())
(define tokens1 '()) ;;for look ahead
(define cc #f)
(define semicolon-end? #f)
(define period-end? #f)
(define bracket-end? #f)
(define then-end? #f)
;;Sapphire for r7rs test version
(import (scheme base)
(scheme char)
(scheme complex)
(scheme eval)
(scheme file)
(scheme inexact)
(scheme lazy)
(scheme repl)
(scheme process-context)
@sasagawa888
sasagawa888 / poly.h
Created December 29, 2011 09:48
poly.h
/* Poly (simple Scheme interpreter)
written by kenichi sasagawa 2011/12
*/
#define CELLSIZE 1000000
#define HEAPSIZE 799999
#define CONTSTK 800000
#define PALASTK 900000
@sasagawa888
sasagawa888 / poly.c
Created December 29, 2011 09:47
poly.c
/* (simple Scheme interpreter)
written by kenichi sasagawa 2011/12start
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>