-
Notifications
You must be signed in to change notification settings - Fork 609
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
Allow seed to be set for serialized pipeline #1844
Conversation
Signed-off-by: Michał Szołucha <szal@szal-mbp.local>
Signed-off-by: Michał Szołucha <szal@szal-mbp.local>
!build |
CI MESSAGE: [1220604]: BUILD STARTED |
CI MESSAGE: [1220604]: BUILD FAILED |
dali/pipeline/pipeline.h
Outdated
@@ -96,7 +96,7 @@ class DLL_PUBLIC Pipeline { | |||
} | |||
|
|||
DLL_PUBLIC Pipeline(const string &serialized_pipe, int batch_size = -1, int num_threads = -1, | |||
int device_id = -1, bool pipelined_execution = true, | |||
int device_id = -1, int64_t seed = -1, bool pipelined_execution = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now any code that uses the old Pipeline(const string &serialized_pipe
signature is brokenand no one knows why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about moving it to the last position?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it is inconsistent in a different way with other constructors.
|
That is true that others FWs accepts also negative values, but I don't know if this is used by anyone. If we want to truly support this we need to rework |
Signed-off-by: Michał Szołucha <szal@szal-mbp.local>
!build |
CI MESSAGE: [1221209]: BUILD STARTED |
CI MESSAGE: [1221209]: BUILD FAILED |
CI MESSAGE: [1221209]: BUILD PASSED |
Similarly to other Pipeline params (refer the other ctor), this PR allows
seed
to be set for ctor with serialized pipeline.Few comments required:
I'm aware, that
-1
might be legitimate seed value, thus prolly shouldn't be a default value, but not in our code:Without
optional
there's no clean way to handle default seed in this case. I could go withint64_t* seed = nullptr
, but alongside the rest of parameters, it would be obscure.using optional = std::pair<T, bool>
also looks questinably compliated. Plus, we go with-1
as default seed anyway: in the other ctor.I have an impression, that the seed was used incorrectly. Let's say, that
-1
is passed to theInit(...)
.original_seed_
is set to-1
. Then, in the snippet I pasted above,seed
is set according to clock. Finally, when somebody serializes the pipeline (SerializeToProtobuf
), the-1
is set as theoriginal_seed_
, instead of the clock-wise value assigned before. It might be intentional though, please double-check.Signed-off-by: Michał Szołucha szal@szal-mbp.local