params += cell1.get_params()
    params += cell2.get_params()
    params += cell3.get_params()

    inp_to_h1 = GRUFork(input_dim, n_hid, random_state)
    inp_to_h2 = GRUFork(input_dim, n_hid, random_state)
    inp_to_h3 = GRUFork(input_dim, n_hid, random_state)
    att_to_h1 = GRUFork(n_chars, n_hid, random_state)
    att_to_h2 = GRUFork(n_chars, n_hid, random_state)
    att_to_h3 = GRUFork(n_chars, n_hid, random_state)
    h1_to_h2 = GRUFork(n_hid, n_hid, random_state)
    h1_to_h3 = GRUFork(n_hid, n_hid, random_state)
    h2_to_h3 = GRUFork(n_hid, n_hid, random_state)

    params += inp_to_h1.get_params()
    params += inp_to_h2.get_params()
    params += inp_to_h3.get_params()
    params += att_to_h1.get_params()
    params += att_to_h2.get_params()
    params += att_to_h3.get_params()
    params += h1_to_h2.get_params()
    params += h1_to_h3.get_params()
    params += h2_to_h3.get_params()

    biases += inp_to_h1.get_biases()
    biases += inp_to_h2.get_biases()
    biases += inp_to_h3.get_biases()
    biases += att_to_h1.get_biases()
    biases += att_to_h2.get_biases()
    biases += att_to_h3.get_biases()
    init_w = tensor.matrix("init_w")
    init_w.tag.test_value = np_zeros((minibatch_size, n_chars))

    params = []
    w_conv1, = make_conv_weights(1, (n_kernels,), (conv_size1, input_dim),
                                 random_state)
    b_conv1, = make_biases((n_kernels,))
    w_conv2, = make_conv_weights(n_kernels, (n_kernels,),
                                 (conv_size2, 1), random_state)
    b_conv2, = make_biases((n_kernels,))
    params += [w_conv1, b_conv1, w_conv2, b_conv2]

    # Use GRU classes only to fork 1 inp to 2 inp:gate pairs
    conv_to_h1 = GRUFork(n_kernels, n_hid, random_state)
    conv_to_h2 = GRUFork(n_kernels, n_hid, random_state)
    params += conv_to_h1.get_params()
    params += conv_to_h2.get_params()

    cell1 = GRU(n_kernels, n_hid, random_state)
    cell2 = GRU(n_hid, n_hid, random_state)
    params += cell1.get_params()
    params += cell2.get_params()

    # Use GRU classes only to fork 1 inp to 2 inp:gate pairs
    att_to_h1 = GRUFork(n_chars, n_hid, random_state)
    att_to_h2 = GRUFork(n_chars, n_hid, random_state)
    h1_to_h2 = GRUFork(n_hid, n_hid, random_state)

    params += att_to_h1.get_params()
    params += att_to_h2.get_params()
    params += h1_to_h2.get_params()
Пример #3
0
    init_w = tensor.matrix("init_w")
    init_w.tag.test_value = np_zeros((minibatch_size, n_chars))

    params = []
    w_conv1, = make_conv_weights(1, (n_kernels, ), (conv_size1, input_dim),
                                 random_state)
    b_conv1, = make_biases((n_kernels, ))
    w_conv2, = make_conv_weights(n_kernels, (n_kernels, ), (conv_size2, 1),
                                 random_state)
    b_conv2, = make_biases((n_kernels, ))
    params += [w_conv1, b_conv1, w_conv2, b_conv2]

    # Use GRU classes only to fork 1 inp to 2 inp:gate pairs
    conv_to_h1 = GRUFork(n_kernels, n_hid, random_state)
    conv_to_h2 = GRUFork(n_kernels, n_hid, random_state)
    params += conv_to_h1.get_params()
    params += conv_to_h2.get_params()

    cell1 = GRU(n_kernels, n_hid, random_state)
    cell2 = GRU(n_hid, n_hid, random_state)
    params += cell1.get_params()
    params += cell2.get_params()

    # Use GRU classes only to fork 1 inp to 2 inp:gate pairs
    att_to_h1 = GRUFork(n_chars, n_hid, random_state)
    att_to_h2 = GRUFork(n_chars, n_hid, random_state)
    h1_to_h2 = GRUFork(n_hid, n_hid, random_state)

    params += att_to_h1.get_params()
    params += att_to_h2.get_params()
    params += h1_to_h2.get_params()
    params += cell1.get_params()
    params += cell2.get_params()
    params += cell3.get_params()

    inp_to_h1 = GRUFork(input_dim, n_hid, random_state)
    inp_to_h2 = GRUFork(input_dim, n_hid, random_state)
    inp_to_h3 = GRUFork(input_dim, n_hid, random_state)
    att_to_h1 = GRUFork(n_chars, n_hid, random_state)
    att_to_h2 = GRUFork(n_chars, n_hid, random_state)
    att_to_h3 = GRUFork(n_chars, n_hid, random_state)
    h1_to_h2 = GRUFork(n_hid, n_hid, random_state)
    h1_to_h3 = GRUFork(n_hid, n_hid, random_state)
    h2_to_h3 = GRUFork(n_hid, n_hid, random_state)

    params += inp_to_h1.get_params()
    params += inp_to_h2.get_params()
    params += inp_to_h3.get_params()
    params += att_to_h1.get_params()
    params += att_to_h2.get_params()
    params += att_to_h3.get_params()
    params += h1_to_h2.get_params()
    params += h1_to_h3.get_params()
    params += h2_to_h3.get_params()

    biases += inp_to_h1.get_biases()
    biases += inp_to_h2.get_biases()
    biases += inp_to_h3.get_biases()
    biases += att_to_h1.get_biases()
    biases += att_to_h2.get_biases()
    biases += att_to_h3.get_biases()
Пример #5
0
    cell1 = GRU(input_dim, n_hid, random_state)
    cell2 = GRU(n_hid, n_hid, random_state)
    cell3 = GRU(n_hid, n_hid, random_state)

    params += cell1.get_params()
    params += cell2.get_params()
    params += cell3.get_params()

    inp_to_h1 = GRUFork(input_dim, n_hid, random_state)
    inp_to_h2 = GRUFork(input_dim, n_hid, random_state)
    inp_to_h3 = GRUFork(input_dim, n_hid, random_state)
    h1_to_h2 = GRUFork(n_hid, n_hid, random_state)
    h1_to_h3 = GRUFork(n_hid, n_hid, random_state)
    h2_to_h3 = GRUFork(n_hid, n_hid, random_state)

    params += inp_to_h1.get_params()
    params += inp_to_h2.get_params()
    params += inp_to_h3.get_params()
    params += h1_to_h2.get_params()
    params += h1_to_h3.get_params()
    params += h2_to_h3.get_params()

    biases += inp_to_h1.get_biases()
    biases += inp_to_h2.get_biases()
    biases += inp_to_h3.get_biases()
    biases += h1_to_h2.get_biases()
    biases += h1_to_h3.get_biases()
    biases += h2_to_h3.get_biases()

    h1_to_outs, = make_weights(n_hid, [n_proj], random_state)
    h2_to_outs, = make_weights(n_hid, [n_proj], random_state)