f869e085bd216a1e9d2f1066da783e74067810e3,src/Model.py,Model,trainBatch,#Model#,202
Before Change
"feed a batch into the NN to train it"
sparse = self.toSparse(batch.gtTexts)
rate = 0.01 if self.batchesTrained < 10 else (0.001 if self.batchesTrained < 10000 else 0.0001) // decay learning rate
(_, lossVal) = self.sess.run([self.optimizer, self.loss], { self.inputImgs : batch.imgs, self.gtTexts : sparse , self.seqLen : [Model.maxTextLen] * Model.batchSize, self.learningRate : rate} )
self.batchesTrained += 1
return lossVal
After Change
def trainBatch(self, batch):
"feed a batch into the NN to train it"
numBatchElements = len(batch.imgs)
sparse = self.toSparse(batch.gtTexts)
rate = 0.01 if self.batchesTrained < 10 else (0.001 if self.batchesTrained < 10000 else 0.0001) // decay learning rate
evalList = [self.optimizer, self.loss]
feedDict = {self.inputImgs : batch.imgs, self.gtTexts : sparse , self.seqLen : [Model.maxTextLen] * numBatchElements, self.learningRate : rate}
(_, lossVal) = self.sess.run(evalList, feedDict)
self.batchesTrained += 1
return lossVal
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 4
Instances
Project Name: githubharald/SimpleHTR
Commit Name: f869e085bd216a1e9d2f1066da783e74067810e3
Time: 2019-01-02
Author: harald_scheidl@hotmail.com
File Name: src/Model.py
Class Name: Model
Method Name: trainBatch
Project Name: githubharald/SimpleHTR
Commit Name: f869e085bd216a1e9d2f1066da783e74067810e3
Time: 2019-01-02
Author: harald_scheidl@hotmail.com
File Name: src/Model.py
Class Name: Model
Method Name: inferBatch
Project Name: pysb/pysb
Commit Name: 47374cd825213029b578e5a22ba9836c0f55d97a
Time: 2015-07-03
Author: oo.ortega2247@gmail.com
File Name: pysb/tools/pysb_pyurdme.py
Class Name: PyurdmeSimulator
Method Name: run
Project Name: THUNLP-MT/THUMT
Commit Name: 410992318552115d2e3de84844bf523012e3e98e
Time: 2019-11-26
Author: cg847519328@163.com
File Name: thumt/utils/hooks.py
Class Name:
Method Name: _evaluate