Image batch as a tf.Variable

Hi,

could anyone please explain why is the image_batch beating converted into a tf.Variable before giving it to base_model(image_var)?
Here is the block of the code I am referring to:

base_model.trainable = False
image_var = tf.Variable(image_batch)
pred = base_model(image_var)
tf.keras.applications.mobilenet_v2.decode_predictions(pred.numpy(), top=2)

this is in the assignment Transfer_learning_with_MobileNet_v1, in the section 3.2.

Thanks
Henrikh

From correctness perspective, the prediction type and values will be the same for both calls:

pred = base_model(image_var)
# and
pred = base_model(image_batch)

You don’t have to create image_var.

Thank you!

Regards
Henrikh