Skip to content

Instantly share code, notes, and snippets.

@natsutan
natsutan / grammer.rs
Created September 23, 2019 13:39
マクロ
static ARTICLE_TABLE:[&str; 2] = ["a", "the"];
static NOUN_TABLE:[&str; 4] = ["man", "ball", "woman", "table"];
static VERB_TABLE:[&str; 4] = ["hit", "took", "saw", "liked"];
fn random_elm_idx(i:usize) -> usize {
let mut rng = rand::thread_rng();
rng.gen_range(0, i as u32) as usize
}
macro_rules! simple_rule {
.cpu cortex-a53
.eabi_attribute 27, 3
.eabi_attribute 28, 1
.fpu neon-fp16
.eabi_attribute 23, 1
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 2
.eabi_attribute 30, 2
.eabi_attribute 34, 1
#include <string.h>
#include <limits.h>
#include <assert.h>
#include "cqt.h"
#include "cqt_net.h"
int CQT_Conv2D_same_3x3_ifp16_wfp16_ofp16 (CQT_LAYER *lp, void *inp, void *outp)
{
FP16 filter3x3[3][3];
#include <string.h>
#include <limits.h>
#include <assert.h>
#include "cqt.h"
#include "cqt_net.h"
int CQT_Conv2D_same_3x3_if_wf_of (CQT_LAYER *lp, void *inp, void *outp)
{
float filter3x3[3][3];
#include <string.h>
#include <assert.h>
#include "cqt.h"
#include "cqt_net.h"
#include <omp.h>
/// Super version
//#include <emmintrin.h> ///SSE2
//#include <pmmintrin.h> //SSE3
//#include <tmmintrin.h> //SSSE3
"""Some special pupropse layers for SSD."""
import keras.backend as K
from keras.engine.topology import InputSpec
from keras.engine.topology import Layer
import numpy as np
import tensorflow as tf
class Normalize(Layer):
@natsutan
natsutan / ssd_layers.py
Created March 20, 2017 15:28
JSONに変換できるSSDカスタムレイヤー
"""Some special pupropse layers for SSD."""
import keras.backend as K
from keras.engine.topology import InputSpec
from keras.engine.topology import Layer
import numpy as np
import tensorflow as tf
class Normalize(Layer):
def q_mul_core(a_qt, a_min, a_max, b_qt, b_min, b_max, debug=False):
"""乗算"""
gain_a = (a_max - a_min) / MAX_VALUE
gain_b = (b_max - b_min) / MAX_VALUE
min = a_min * b_min
max = a_max * b_max
q_param = MAX_VALUE / (max - min)
p_gagb = gain_a * gain_b * q_param
p_gaob = gain_a * b_min * q_param
@natsutan
natsutan / *Backtrace*
Created October 22, 2012 05:38
(require gdev) するとorg-modeのhtml-exportdでエラー
Debugger entered--Lisp error: (wrong-type-argument stringp (sgml-xml-mode "XHTML" "HTML"))
gdev:after-save-hooks()
string=("Scheme" (sgml-xml-mode "XHTML" "HTML"))
(and gdev:enable-gdev (string= "Scheme" mode-name))
(if (and gdev:enable-gdev (string= "Scheme" mode-name)) (progn (gdev:parse-cur-buf-from-file)))
(when (and gdev:enable-gdev (string= "Scheme" mode-name)) (gdev:parse-cur-buf-from-file))
gdev:after-save-hooks()
run-hooks(after-save-hook)
basic-save-buffer()
@natsutan
natsutan / gist:3877198
Created October 12, 2012 03:50
thread apply all bt
r = 0 errno = 0
file_filler 2 r = 0
file_filler 4
[New Thread 11088.0x246c]
[New Thread 11088.0x2aa0]
[New Thread 11088.0x2918]
[New Thread 11088.0x2b34]
[New Thread 11088.0x2a9c]
[New Thread 11088.0x2a18]