-
Notifications
You must be signed in to change notification settings - Fork 666
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
Optimize myNetwork.standalone() #139
Comments
well, PRs are always welcome. Bad thing is that there's no tests for .standalone right now, so they are required too for a nice PR. |
OK. I'll propose an optimization function. Maybe, someone will change the function to an object with local variables and a calculations sub-function: function themodel(){ Then the object is than called like this: myModel = new themodel(); // initialization result = myModel.calculate([1,0,1,1]); // calculation This way we avoid initializing the local variables every time. This should improve calculations. |
Marias, AFAIK this fn was aimed to deliver code as small as possible - otherwise it's more sane to use JSON-encoded network and Network.fromJSON, so possibly using something like higher-order function can be good, still making an actual code generator with big API is not very reasonable. Let's wait @cazala to get more info about this fn, he'll be available in early October |
So my simple solution is:
|
What's the point if this solution? |
Given a string representation of the function it removes unused parameters and sets overwritten parameters to 0. |
We need tests first anyway 😞 Some of moving parts here are not working as expected, and I'm even not sure that this one is acting properly right now - it's not covered. |
Hi.
Is there something wrong with myNetwork.standalone()?
I did test on:
The output of standalone is:
I did a simple test by removing the "//overwritten - newer used" values and setting the "//overwritten" values to zero. This steps removed some unnecessary calculations and made the parameters smaller. The output was basically identical to the original model.
Can someone remove this dead code and unnecessary values?
The text was updated successfully, but these errors were encountered: