def init_mlp_recognize(hdims, n, p, scale=1e-2):
    dims = [p] + hdims
    nnet_params = map(partial(init_layer, scale=scale),
                      zip(dims[:-1], dims[1:]))
    W_mu, b_mu = init_layer((dims[-1], n), scale)
    W_sigma, b_sigma = init_layer((dims[-1], n), scale)
    return nnet_params + [(W_mu, b_mu), (W_sigma, b_sigma)]
def init_binary_decoder(N_in, hdims, N_out):
    dims = [N_in] + hdims + [N_out]
    return [init_layer(shape) for shape in zip(dims[:-1], dims[1:])]
def init_encoder(N_in, hdims, N_out):
    dims = [N_in] + hdims
    nnet_params = [init_layer(shape) for shape in zip(dims[:-1], dims[1:])]
    W_mu, b_mu = init_layer((hdims[-1], N_out))
    W_sigma, b_sigma = init_layer((hdims[-1], N_out))
    return nnet_params + [(W_mu, b_mu), (W_sigma, b_sigma)]
def init_binary_decoder(N_in, hdims, N_out):
    dims = [N_in] + hdims + [N_out]
    return [init_layer(shape) for shape in zip(dims[:-1], dims[1:])]
def init_encoder(N_in, hdims, N_out):
    dims = [N_in] + hdims
    nnet_params = [init_layer(shape) for shape in zip(dims[:-1], dims[1:])]
    W_mu, b_mu = init_layer((hdims[-1], N_out))
    W_sigma, b_sigma = init_layer((hdims[-1], N_out))
    return nnet_params + [(W_mu, b_mu), (W_sigma, b_sigma)]
def init_mlp_recognize(hdims, n, p):
    dims = [p] + hdims
    nnet_params = map(init_layer, zip(dims[:-1], dims[1:]))
    W_mu, b_mu = init_layer((dims[-1], n))
    W_sigma, b_sigma = init_layer((dims[-1], n))
    return nnet_params + [(W_mu, b_mu), (W_sigma, b_sigma)]