def learn(self, experiences):
    'Update policy and value parameters using given batch of experience tuples.'
    states = np.vstack([e.state for e in experiences if (e is not None)])
    actions = np.array([e.action for e in experiences if (e is not None)]).astype(np.float32).reshape((- 1), self.action_size)
    rewards = np.array([e.reward for e in experiences if (e is not None)]).astype(np.float32).reshape((- 1), 1)
    dones = np.array([e.done for e in experiences if (e is not None)]).astype(np.uint8).reshape((- 1), 1)
    next_states = np.vstack([e.next_state for e in experiences if (e is not None)])
    actions_next = self.actor_target.model.predict_on_batch(next_states)
    Q_targets_next = self.critic_target.model.predict_on_batch([next_states, actions_next])
    Q_targets = (rewards + ((self.gamma * Q_targets_next) * (1 - dones)))
    self.critic_local.model.train_on_batch(x=[states, actions], y=Q_targets)
    action_gradients = np.reshape(self.critic_local.get_action_gradients([states, actions, 0]), ((- 1), self.action_size))
    self.actor_local.train_fn([states, action_gradients, 1])
    self.soft_update(self.critic_local.model, self.critic_target.model)
    self.soft_update(self.actor_local.model, self.actor_target.model)
Update policy and value parameters using given batch of experience tuples.
def learn(self, experiences):
    
    states = np.vstack([e.state for e in experiences if (e is not None)])
    actions = np.array([e.action for e in experiences if (e is not None)]).astype(np.float32).reshape((- 1), self.action_size)
    rewards = np.array([e.reward for e in experiences if (e is not None)]).astype(np.float32).reshape((- 1), 1)
    dones = np.array([e.done for e in experiences if (e is not None)]).astype(np.uint8).reshape((- 1), 1)
    next_states = np.vstack([e.next_state for e in experiences if (e is not None)])
    actions_next = self.actor_target.model.predict_on_batch(next_states)
    Q_targets_next = self.critic_target.model.predict_on_batch([next_states, actions_next])
    Q_targets = (rewards + ((self.gamma * Q_targets_next) * (1 - dones)))
    self.critic_local.model.train_on_batch(x=[states, actions], y=Q_targets)
    action_gradients = np.reshape(self.critic_local.get_action_gradients([states, actions, 0]), ((- 1), self.action_size))
    self.actor_local.train_fn([states, action_gradients, 1])
    self.soft_update(self.critic_local.model, self.critic_target.model)
    self.soft_update(self.actor_local.model, self.actor_target.model)