Skip to content

[BUG Report]: v0.150.0 breaks multi-input models fit #1211

@Utanapishtim31

Description

@Utanapishtim31

Description

Before TensorFlow.NET v0.150.0 in order to train a multi-input model, I used the method Model.fit(IEnumerable x, NDArray y, ...) with validation_data as a tuple (IEnumerable, NDArray). The enumeration IEnumerable of validation_data contains the several inputs of the model.

With v0.150.0, the tuple is implicitly cast to a ValidationDataPack but this cast keeps only the first NDArray of the validation_data.Item1 enumeration:

public ValidationDataPack((IEnumerable<NDArray>, NDArray) validation_data)
{
    this.val_x = validation_data.Item1.ToArray()[0]; <-- incompatible with multi-input!
    this.val_y = validation_data.Item2;
}

The call to Model.evaluate() in Model.FitInternal() then obviously fails since the validation data format does not match the model inputs anymore.

Reproduction Steps

The problem is obvious.

Known Workarounds

Maybe use the method Model.fit(IDatasetV2 dataset, ..., IDatasetV2 validation_data), but how do I create an IDatasetV2 from a tuple (IEnumerable, NDArray) ?

Configuration and Other Information

TensorFlow.NET 0.150.0
TensorFlow.Keras 0.15.0
Windows 11

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions