示例#1
0
def make_last_layer(l3,w_shape,p_drop_hidden=0.0):
    w_h = ml_tools.init_kernels(w_shape[0])
    hidden_layer = rectify(T.dot(l3, w_h))
    l4 = dropout(hidden_layer, p_drop_hidden)
    w_o = ml_tools.init_kernels(w_shape[1])
    out_layer = softmax(T.dot(l4, w_o))
    last_layer=LastLayer(hidden_layer,w_h,out_layer,w_o)
    return last_layer
示例#2
0
def make_conv_layer(in_data,w_shape,p_drop_conv=0.0,
                    first=False,flat=False):
    w = ml_tools.init_kernels(w_shape)
    if(first):
        la = rectify(conv2d(in_data, w, border_mode='full'))
    else:
        la = rectify(conv2d(in_data, w))
    l = max_pool_2d(la, (2, 2))
    if(flat):
        l = T.flatten(l, outdim=2)
    layer=dropout(l, p_drop_conv) 
    return ConvLayer(layer,w)