Skip to content

Instantly share code, notes, and snippets.

View whaozl's full-sized avatar

Anjos whaozl

View GitHub Profile
//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"),
/*
* 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 */
@dapurv5
dapurv5 / Complex.java
Created January 2, 2013 19:34
Complex Number representation
import java.lang.Math;
public class Complex {
protected double re;
protected double im;
public Complex(double real, double imag) {
re = real;
im = imag;
@dapurv5
dapurv5 / FFT.java
Created January 2, 2013 16:53
Decorator over JTransforms for computing FFTs in NumPy fashion in Java
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){