'Sample all actions given output of core network.'

def sample_actions(self, output, actions=None, greedy=False):

    sampled_actions = []
    logits = []
    log_probs = []
    entropy = []
    self_kl = []
    start_idx = 0
    for (i, (act_dim, act_type)) in enumerate(self.env_spec.act_dims_and_types):
        sampling_dim = self.env_spec.sampling_dim(act_dim, act_type)
        if (self.fixed_std and self.env_spec.is_box(act_type)):
            act_logits = output[:, start_idx:(start_idx + act_dim)]
            log_std = tf.get_variable(('std%d' % i), [1, (sampling_dim // 2)])
            act_logits = tf.concat([act_logits, ((1e-06 + tf.exp(log_std)) + (0 * act_logits))], 1)
        else:
            act_logits = output[:, start_idx:(start_idx + sampling_dim)]
        if (actions is None):
            act = self.sample_action(act_logits, sampling_dim, act_dim, act_type, greedy=greedy)
        else:
            act = actions[i]
        ent = self.entropy(act_logits, sampling_dim, act_dim, act_type)
        kl = self.self_kl(act_logits, sampling_dim, act_dim, act_type)
        act_log_prob = self.log_prob_action(act, act_logits, sampling_dim, act_dim, act_type)
        sampled_actions.append(act)
        logits.append(act_logits)
        log_probs.append(act_log_prob)
        entropy.append(ent)
        self_kl.append(kl)
        start_idx += sampling_dim
    assert (start_idx == self.env_spec.total_sampling_act_dim)
    return (sampled_actions, logits, log_probs, entropy, self_kl)
