parameters: (self, obs, ended)
return_statement: return Variable(a, requires_grad=False).cuda()
docstring: Extract teacher actions into variable.
docstring_summary: Extract teacher actions into variable.
docstring_tokens: Extract teacher actions into variable .
function: def _teacher_action(self, obs, ended):
          ''' Extract teacher actions into variable. '''
          a = torch.LongTensor(len(obs))
          for i,ob in enumerate(obs):
              # Supervised teacher only moves one axis at a time
              ix,heading_chg,elevation_chg = ob['teacher']
              if heading_chg > 0:
                  a[i] = self.model_actions.index('right')
              elif heading_chg < 0:
                  a[i] = self.model_actions.index('left')
              elif elevation_chg > 0:
                  a[i] = self.model_actions.index('up')
              elif elevation_chg < 0:
                  a[i] = self.model_actions.index('down')
              elif ix > 0:
                  a[i] = self.model_actions.index('forward')
              elif ended[i]:
                  a[i] = self.model_actions.index('<ignore>')
              else:
                  a[i] = self.model_actions.index('<end>')
          return Variable(a, requires_grad=False).cuda()
function_tokens: def _teacher_action ( self , obs , ended ) : a = torch . LongTensor ( len ( obs ) ) for i , ob in enumerate ( obs ) : # Supervised teacher only moves one axis at a time ix , heading_chg , elevation_chg = ob [ 'teacher' ] if heading_chg > 0 : a [ i ] = self . model_actions . index ( 'right' ) elif heading_chg < 0 : a [ i ] = self . model_actions . index ( 'left' ) elif elevation_chg > 0 : a [ i ] = self . model_actions . index ( 'up' ) elif elevation_chg < 0 : a [ i ] = self . model_actions . index ( 'down' ) elif ix > 0 : a [ i ] = self . model_actions . index ( 'forward' ) elif ended [ i ] : a [ i ] = self . model_actions . index ( '<ignore>' ) else : a [ i ] = self . model_actions . index ( '<end>' ) return Variable ( a , requires_grad = False ) . cuda ( )