-
Notifications
You must be signed in to change notification settings - Fork 105
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
[Bug] Suspiciously slow calls to Sequential.predictSoftly
#25
Comments
a.) |
@LostMekka thanks a lot for your performance experiment, It looks great.
|
Sequential.predictSoftly
Sequential.predictSoftly
That would be awesome as well. My current pet project to try out this library is a board game AI that very crudely learns through self play, where the neural net is the search heuristic. The AI plays a semi-random game sequence and for each pair of successive moves I create a training data point. (needs 1 predictSoftly per data point) Building these self-play datasets would probably greatly benefit from batch soft-predicting 😄 Should I add a second issue for this? |
Great idea for pet-project, so, hope it will be helpful, please create a separate ticket for this case as an feature request. |
Dear @quickstep24
The reason to use are the following:
|
It is probably me misinterpreting the documentation of
I did assume that this constructor would also work on 1-dim float arrays, but I have never tried. |
@quickstep24 I will explain my message. Yes, you can pass the 1-dim floatArray. But I need to pass a shape (to transform it to 2d/3d/4d) - but in this case this method requires 4d float array. It is not useful for me in this case, because the shape could be unknown and I want more generic code. But I agree, that in future need to minimize overhead with copying, will keep in mind such places. |
Calls to
Sequential.predictSoftly
start out fairly slow and each call takes a bit more time than the last one.My example model is quite small, but the first call already takes about 25ms on my machine. (for comparison: fitting 1.000 random data points with 10 epochs takes 415ms) After calling predictSoftly 10.000 times, each successive call takes a third of a second.
Code to reproduce:
The text was updated successfully, but these errors were encountered: