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 regression - keras fit class weights are being cast to int #37916

Merged
merged 1 commit into from Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion tensorflow/python/keras/engine/data_adapter.py
Expand Up @@ -1237,7 +1237,7 @@ def _make_class_weight_map_fn(class_weight):
raise ValueError(error_msg)

class_weight_tensor = ops.convert_to_tensor_v2(
[int(class_weight[c]) for c in class_ids], dtype="int64")
[class_weight[int(c)] for c in class_ids])

def _class_weights_map_fn(*data):
"""Convert `class_weight` to `sample_weight`."""
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/python/keras/engine/training_test.py
Expand Up @@ -1408,7 +1408,7 @@ def test_class_weights(self):
batch_size = 5
epochs = 10
weighted_class = 3
weight = 10.
weight = .5
train_samples = 1000
test_samples = 1000
input_dim = 5
Expand Down