This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//used for training | |
def bi_lstm_unroll(seq_len, input_size,num_hidden, num_embed, num_label, dropout=0.): | |
embed_weight = mx.sym.Variable("embed_weight") | |
cls_weight = mx.sym.Variable("cls_weight") | |
cls_bias = mx.sym.Variable("cls_bias") | |
last_states = [] | |
last_states.append(LSTMState(c = mx.sym.Variable("l0_init_c"), h = mx.sym.Variable("l0_init_h"))) | |
last_states.append(LSTMState(c = mx.sym.Variable("l1_init_c"), h = mx.sym.Variable("l1_init_h"))) | |
forward_param = LSTMParam(i2h_weight=mx.sym.Variable("l0_i2h_weight"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Generic hashmap manipulation functions | |
* SEE: http://elliottback.com/wp/hashmap-implementation-in-c/ | |
*/ | |
#ifndef __HASHMAP_H__ | |
#define __HASHMAP_H__ | |
#define MAP_MISSING -3 /* No such element */ | |
#define MAP_FULL -2 /* Hashmap is full */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.Math; | |
public class Complex { | |
protected double re; | |
protected double im; | |
public Complex(double real, double imag) { | |
re = real; | |
im = imag; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import edu.emory.mathcs.jtransforms.fft.DoubleFFT_1D; | |
/** | |
* Wrapper class over JTransforms library for fourier transforms. | |
* @author apurv | |
* | |
*/ | |
public class FFT { | |
public static Complex[] fft1D(Complex[] signal){ |