Commit ca6f9026 authored by Pavithra Vijay's avatar Pavithra Vijay Committed by A. Unique TensorFlower
Browse files

Internal change

PiperOrigin-RevId: 291432304
parent ec553860
......@@ -76,8 +76,6 @@ def parse_record(raw_record, is_training, dtype):
image = preprocess_image(image, is_training)
image = tf.cast(image, dtype)
# TODO(haoyuzhang,hongkuny,tobyboyd): Remove or replace the use of V1 API
label = tf.compat.v1.sparse_to_dense(label, (NUM_CLASSES,), 1)
return image, label
......
......@@ -161,17 +161,17 @@ def run(flags_obj):
# a valid arg for this model. Also remove as a valid flag.
if flags_obj.force_v2_in_keras_compile is not None:
model.compile(
loss='categorical_crossentropy',
loss='sparse_categorical_crossentropy',
optimizer=optimizer,
metrics=(['categorical_accuracy']
metrics=(['sparse_categorical_accuracy']
if flags_obj.report_accuracy_metrics else None),
run_eagerly=flags_obj.run_eagerly,
experimental_run_tf_function=flags_obj.force_v2_in_keras_compile)
else:
model.compile(
loss='categorical_crossentropy',
loss='sparse_categorical_crossentropy',
optimizer=optimizer,
metrics=(['categorical_accuracy']
metrics=(['sparse_categorical_accuracy']
if flags_obj.report_accuracy_metrics else None),
run_eagerly=flags_obj.run_eagerly)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment