def check_model(model, model_name, x, y, check_model_io=True):
    """
    compile model,train and evaluate it,then save/load weight and model file.
    :param model:
    :param model_name:
    :param x:
    :param y:
    :param check_model_io: test save/load model file or not
    :return:
    """

    model.fit(x, y, batch_size=10, epochs=2, validation_split=0.5)

    print(model_name + " test train valid pass!")

    user_embedding_model = Model(inputs=model.user_input, outputs=model.user_embedding)
    item_embedding_model = Model(inputs=model.item_input, outputs=model.item_embedding)

    _ = user_embedding_model.predict(x, batch_size=2 ** 12)
    # user_embs = user_embs[:, i, :]  i in [0,k_max) if MIND
    print(model_name + " user_emb pass!")
    _ = item_embedding_model.predict(x, batch_size=2 ** 12)

    print(model_name + " item_emb pass!")

    model.save_weights(model_name + '_weights.h5')
    model.load_weights(model_name + '_weights.h5')
    os.remove(model_name + '_weights.h5')
    print(model_name + " test save load weight pass!")
    if check_model_io:
        save_model(model, model_name + '.h5')
        model = load_model(model_name + '.h5', custom_objects)
        os.remove(model_name + '.h5')
        print(model_name + " test save load model pass!")

    print(model_name + " test pass!")
    # print(1)
    #
    # save_model(item_embedding_model, model_name + '.user.h5')
    # print(2)
    #
    # item_embedding_model = load_model(model_name + '.user.h5', custom_objects)
    # print(3)
    #
    # item_embs = item_embedding_model.predict(x, batch_size=2 ** 12)
    # print(item_embs)
    # print("go")

    compile model,train and evaluate it,then save/load weight and model file.
    :param model:
    :param model_name:
    :param x:
    :param y:
    :param check_model_io: test save/load model file or not
    :return:
    
tests/utils.py