import tensorflow as tf


    tflite_model = converter.convert()

    with open(f"{target_dir}/tflite_model.tflite", "wb") as f:
        f.write(tflite_model)
        
def validation():
    
    (x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
    images = tf.convert_to_tensor(np.expand_dims(x_test/255.0, -1),dtype=tf.float32)

    # Load the TFLite model in TFLite Interpreter
    interpreter = tf.lite.Interpreter(f"{target_dir}/tflite_model.tflite")
 
     # Model has single input.  
    in_node = interpreter.get_input_details()[0]  
    in_shape = in_node['shape']
       
    # Model has single output.
    out_node = interpreter.get_output_details()[0]
    out_shape = out_node['shape']

    # Resize Tensor (batch size)
    interpreter.resize_tensor_input(in_node['index'],[len(images), in_shape[1], in_shape[2], in_shape[3]])    
