-
Notifications
You must be signed in to change notification settings - Fork 517
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
fix: fix the validation_pack when multiple input #1212
fix: fix the validation_pack when multiple input #1212
Conversation
IEnumerable<Tensor> x, | ||
Tensor y, | ||
int verbose = 1, | ||
NDArray sample_weight = null, |
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.
It's recommended to put sample_weight
the last parameter, to keep its backward compatibility. However if this is exactly the order in python, just keeping it is okay.
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.
Yes, it follow the order in python.
src/TensorFlowNET.Core/Util/Data.cs
Outdated
@@ -8,10 +9,10 @@ namespace Tensorflow.Util | |||
/// </summary> | |||
public class ValidationDataPack | |||
{ | |||
public NDArray val_x; | |||
public OneOf<NDArray, NDArray[]> val_x; |
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.
Is it possible to use NDArray[]
alone since NDArray
could also be an array of length 1? The purpose is to avoid too many APIs with Oneof
exposed to users. If this method is not supposed to be used by our users, I think it's ok.
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.
The only usage of ValidationPack class is to handle the case that the validation_data parameter in model.fit could be a tuple of two NDArray or three NDArray and deconstruct to two NDArray or three NDArray. So it will not used by users.
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.
Please consider declaring it as internal, which prevents being called from users.
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.
Done, really thank you for your advice.
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.
Is the usage of ValidationPack class limited to internal developers? Therefore I think we should declare the whole class as internal.
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.
I have tried, but it is used in model.fit as a parameter, which is public, so it will cause an error : Inconsistent accessibility: parameter type 'type' is less accessible than method 'method'
if declare it as internal.
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.
OK, no problem
fix #1211