Skip to content
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

Merged

Conversation

Wanglongzhi2001
Copy link
Collaborator

@Wanglongzhi2001 Wanglongzhi2001 commented Nov 7, 2023

fix #1211

IEnumerable<Tensor> x,
Tensor y,
int verbose = 1,
NDArray sample_weight = null,
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

@@ -8,10 +9,10 @@ namespace Tensorflow.Util
/// </summary>
public class ValidationDataPack
{
public NDArray val_x;
public OneOf<NDArray, NDArray[]> val_x;
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

Copy link
Collaborator Author

@Wanglongzhi2001 Wanglongzhi2001 Nov 7, 2023

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, no problem

@AsakusaRinne AsakusaRinne merged commit ee004c0 into SciSharp:master Nov 7, 2023
3 checks passed
@Wanglongzhi2001 Wanglongzhi2001 deleted the fix_validation_data_pack branch November 9, 2023 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG Report]: v0.150.0 breaks multi-input models fit
2 participants