original_docstring: feed a batch into the NN to train it
docstring: feed a batch into the NN to train it
docstring_tokens: feed a batch into the NN to train it
code: def trainBatch(self, batch):
          """feed a batch into the NN to train it"""
          numBatchElements = len(batch.imgs)
          sparse = self.toSparse(batch.gtTexts)
          evalList = [self.optimizer, self.loss]
          feedDict = {self.inputImgs: batch.imgs, self.gtTexts: sparse,
                      self.seqLen: [Model.maxTextLen] * numBatchElements, self.is_train: True}
          _, lossVal = self.sess.run(evalList, feedDict)
          self.batchesTrained += 1
          return lossVal
code_tokens: def trainBatch ( self , batch ) : numBatchElements = len ( batch . imgs ) sparse = self . toSparse ( batch . gtTexts ) evalList = [ self . optimizer , self . loss ] feedDict = { self . inputImgs : batch . imgs , self . gtTexts : sparse , self . seqLen : [ Model . maxTextLen ] * numBatchElements , self . is_train : True } _ , lossVal = self . sess . run ( evalList , feedDict ) self . batchesTrained += 1 return lossVal
short_docstring: feed a batch into the NN to train it
short_docstring_tokens: feed a batch into the NN to train it
comment: """feed a batch into the NN to train it"""