diff --git a/tensorflow/examples/label_image/label_image.py b/tensorflow/examples/label_image/label_image.py index fe5e0fc684a..f675ec35ec8 100644 --- a/tensorflow/examples/label_image/label_image.py +++ b/tensorflow/examples/label_image/label_image.py @@ -58,7 +58,7 @@ def read_tensor_from_image_file(file_name, dims_expander = tf.expand_dims(float_caster, 0) resized = tf.image.resize_bilinear(dims_expander, [input_height, input_width]) normalized = tf.divide(tf.subtract(resized, [input_mean]), [input_std]) - sess = tf.Session() + sess = tf.compat.v1.Session() result = sess.run(normalized) return result @@ -128,7 +128,7 @@ if __name__ == "__main__": input_operation = graph.get_operation_by_name(input_name) output_operation = graph.get_operation_by_name(output_name) - with tf.Session(graph=graph) as sess: + with tf.compat.v1.Session(graph=graph) as sess: results = sess.run(output_operation.outputs[0], { input_operation.outputs[0]: t })