':param env_spec:
:param hidden_sizes: list of sizes for the fully-connected hidden layers
:param learn_std: Is std trainable
:param init_std: Initial std
:param adaptive_std:
:param std_share_network:
:param std_hidden_sizes: list of sizes for the fully-connected layers for std
:param min_std: whether to make sure that the std is at least some threshold value, to avoid numerical issues
:param std_hidden_nonlinearity:
:param hidden_nonlinearity: nonlinearity used for each hidden layer
:param output_nonlinearity: nonlinearity for the output layer
:param mean_network: custom network for the output mean
:param std_network: custom network for the output log std
:return:'

def __init__(self, env_spec, hidden_sizes=(32, 32), learn_std=True, init_std=1.0, adaptive_std=False, std_share_network=False, std_hidden_sizes=(32, 32), min_std=1e-06, std_hidden_nonlinearity=NL.tanh, hidden_nonlinearity=NL.tanh, output_nonlinearity=None, mean_network=None, std_network=None, dist_cls=DiagonalGaussian):

    Serializable.quick_init(self, locals())
    assert isinstance(env_spec.action_space, Box)
    obs_dim = env_spec.observation_space.flat_dim
    action_dim = env_spec.action_space.flat_dim
    if (mean_network is None):
        mean_network = MLP(input_shape=(obs_dim,), output_dim=action_dim, hidden_sizes=hidden_sizes, hidden_nonlinearity=hidden_nonlinearity, output_nonlinearity=output_nonlinearity)
    self._mean_network = mean_network
    l_mean = mean_network.output_layer
    obs_var = mean_network.input_layer.input_var
    if (std_network is not None):
        l_log_std = std_network.output_layer
    elif adaptive_std:
        std_network = MLP(input_shape=(obs_dim,), input_layer=mean_network.input_layer, output_dim=action_dim, hidden_sizes=std_hidden_sizes, hidden_nonlinearity=std_hidden_nonlinearity, output_nonlinearity=None)
        l_log_std = std_network.output_layer
    else:
        l_log_std = ParamLayer(mean_network.input_layer, num_units=action_dim, param=lasagne.init.Constant(np.log(init_std)), name='output_log_std', trainable=learn_std)
    self.min_std = min_std
    (mean_var, log_std_var) = L.get_output([l_mean, l_log_std])
    if (self.min_std is not None):
        log_std_var = TT.maximum(log_std_var, np.log(min_std))
    (self._mean_var, self._log_std_var) = (mean_var, log_std_var)
    self._l_mean = l_mean
    self._l_log_std = l_log_std
    self._dist = dist_cls(action_dim)
    LasagnePowered.__init__(self, [l_mean, l_log_std])
    super(GaussianMLPPolicy, self).__init__(env_spec)
    self._f_dist = ext.compile_function(inputs=[obs_var], outputs=[mean_var, log_std_var])
