Skip to content
This repository was archived by the owner on Dec 26, 2018. It is now read-only.

some modify to accelerate the train function #13

Open
younfor opened this issue Jan 4, 2017 · 1 comment
Open

some modify to accelerate the train function #13

younfor opened this issue Jan 4, 2017 · 1 comment

Comments

@younfor
Copy link

younfor commented Jan 4, 2017

in file "paramservermodel.py"
int function def train(self, labels, features):

for i in range(len(self.compute_gradients)):

    #     self.gradients[
    #         i] += self.compute_gradients[i][0].eval(feed_dict=feed)       

because its not necessary to use "for" in this code, replaced by:

grads, test_error_rate = self.session.run([self.compute_gradients,self.error_rate],feed_dict=feed)
self.gradients[:] = [g[0] for g in grads]

this will save several times of gpu train, especial in mnist one iter time from 7ms to 1ms in my computer

@illuzen
Copy link
Contributor

illuzen commented Jan 20, 2017

Excellent catch @younfor ! Makes sense, gotta think about that GPU bus...

Submit a PR?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants