Exemplo n.º 1
0
    start_epoch = 0
    start_iteration = 0
    timestamp = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
    load_weights = None
    print('init new states...')
    print('timestamp: ', timestamp)
print()

# initialize lstm weights

io_size = len(embeddings)  # input/output size
h_size = hidden_layer_size  # hidden size

if not load_weights:

    W_xi = helper.init_weights((io_size, h_size))
    W_hi = helper.init_weights((h_size, h_size))
    W_ci = helper.init_weights((h_size, h_size))
    b_i = helper.init_zero_vec(h_size)

    W_xf = helper.init_weights((io_size, h_size))
    W_hf = helper.init_weights((h_size, h_size))
    W_cf = helper.init_weights((h_size, h_size))
    b_f = helper.init_zero_vec(h_size)

    W_xc = helper.init_weights((io_size, h_size))
    W_hc = helper.init_weights((h_size, h_size))
    b_c = helper.init_zero_vec(h_size)

    W_xo = helper.init_weights((io_size, h_size))
    W_ho = helper.init_weights((h_size, h_size))
Exemplo n.º 2
0
    start_epoch = 0
    start_iteration = 0
    timestamp = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
    load_weights = None
    print('init new states...')
    print('timestamp: ', timestamp)
print()

# initialize lstm weights
    
io_size = len(embeddings) # input/output size
h_size = hidden_layer_size # hidden size

if not load_weights:

    W_xi = helper.init_weights((io_size, h_size))
    W_hi = helper.init_weights((h_size, h_size))
    W_ci = helper.init_weights((h_size, h_size))
    b_i = helper.init_zero_vec(h_size)

    W_xf = helper.init_weights((io_size, h_size))
    W_hf = helper.init_weights((h_size, h_size))
    W_cf = helper.init_weights((h_size, h_size))
    b_f = helper.init_zero_vec(h_size)

    W_xc = helper.init_weights((io_size, h_size))  
    W_hc = helper.init_weights((h_size, h_size))
    b_c = helper.init_zero_vec(h_size)

    W_xo = helper.init_weights((io_size, h_size))
    W_ho = helper.init_weights((h_size, h_size))
Exemplo n.º 3
0
    start_iteration = 0
    timestamp = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
    load_weights = None
    print("init new states...")
    print("timestamp: ", timestamp)
print()

# initialize lstm weights

inp = w2v_embeddings.embeddings_size  # input/output size
hid = hidden_layer_size  # hidden size
out = token_embeddings.num_tokens

if not load_weights:

    W_xi = helper.init_weights((inp, hid))
    W_hi = helper.init_weights((hid, hid))
    W_ci = helper.init_weights((hid, hid))
    b_i = helper.init_zero_vec(hid)

    W_xf = helper.init_weights((inp, hid))
    W_hf = helper.init_weights((hid, hid))
    W_cf = helper.init_weights((hid, hid))
    b_f = helper.init_zero_vec(hid)

    W_xc = helper.init_weights((inp, hid))
    W_hc = helper.init_weights((hid, hid))
    b_c = helper.init_zero_vec(hid)

    W_xo = helper.init_weights((inp, hid))
    W_ho = helper.init_weights((hid, hid))