original_docstring: 
          Perform a single batch gradient descent step with batch size of batchSize 
          
docstring: Perform a single batch gradient descent step with batch size of batchSize
docstring_tokens: Perform a single batch gradient descent step with batch size of batchSize
code: def _batchStep(self,batchSize):
          """
          Perform a single batch gradient descent step with batch size of batchSize 
          """
          
          states, actions, rewards, nextStates, dones = self.memory.torchSample(batchSize)
          
          # Get max predicted Q values (for next states) from target model
          maxQ_dqnTarget = self.dqnTarget(nextStates).detach().max(1)[0].unsqueeze(1)
          # Compute Q targets for current states 
          Q_targets = rewards + (self.gamma * maxQ_dqnTarget * (1 - dones))
  
          # Get expected Q values from local model
          Q_expected = self.dqnLocal(states).gather(1, actions)
  
          # Compute loss
          loss = F.mse_loss(Q_expected, Q_targets)
          # Minimize the loss
          self.optimizer.zero_grad()
          loss.backward()
          self.optimizer.step()
code_tokens: def _batchStep ( self , batchSize ) : states , actions , rewards , nextStates , dones = self . memory . torchSample ( batchSize ) maxQ_dqnTarget = self . dqnTarget ( nextStates ) . detach ( ) . max ( 1 ) [ 0 ] . unsqueeze ( 1 ) Q_targets = rewards + ( self . gamma * maxQ_dqnTarget * ( 1 - dones ) ) Q_expected = self . dqnLocal ( states ) . gather ( 1 , actions ) loss = F . mse_loss ( Q_expected , Q_targets ) self . optimizer . zero_grad ( ) loss . backward ( ) self . optimizer . step ( )
short_docstring: Perform a single batch gradient descent step with batch size of batchSize
short_docstring_tokens: Perform a single batch gradient descent step with batch size of batchSize
comment: """
          Perform a single batch gradient descent step with batch size of batchSize 
          """$SEP$# Get max predicted Q values (for next states) from target model$SEP$# Compute Q targets for current states $SEP$# Get expected Q values from local model$SEP$# Compute loss$SEP$# Minimize the loss