-
Notifications
You must be signed in to change notification settings - Fork 91
Refactor for convnets #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor for convnets #58
Conversation
Adding
Of these, inlining calls to "MATMUL" and elimination of identical function calls within expressions seem like candidates for the cause of the issue. I don't know if this list of optimizations is a complete list or a subset. |
The original neural-fortran code was limited in application because the network type was hardcoded for dense (fully-connected) layers. This PR introduces a large refactor of the library to allow extending it to other network architectures (convolutional for imagery and model data, recurrent for time series, etc.).
Key changes:
input
).nf_
instead ofmod_
, to minimize the chance of name clashes with other libraries that may enter the same namespace in a user application.What's not there anymore:
real64
orreal128
. Rationale: Not too useful to begin with, and can be easily added if anybody asks for it.save
andload
methods to save and load pre-trained networks. Rationale: we'll be adding support for HDF5 I/O soon, and I assume most people who usedsave
andload
did it via FKB rather than the upstream neural-fortran.A nice side-effect of this refactor is that the MNIST training example is about 135% (2.35 times) faster than the original code. This is likely due to the fact that this time around I was careful about minimizing copies and re-allocations. This result is with ifort-2021.3 using
-Ofast
on Intel E5-1650.Known issues:
-O0
), the network does not converge as expected, and this is true for all 3 included examples. For example, the MNIST example it reaches high 80% in one epoch and then slowly drops in subsequent epochs. Same behavior with 9.4.0 and 10.3.0. This issue goes away with-O0
, and doesn't appear at any optimization level with ifort. I hope to diagnose and resolve this before the merge.TODO before merging:
CC @katherbreen