def model_fn(model, features, labels, mode):
    """Model Builder of wide&deep learning models
    Args:
    Returns
    """
    global_step = tf.train.get_or_create_global_step()

    x = dict()
    for i in range(512):
        x_name = "x_{}".format(i)
        x[x_name] = features[x_name]


    num_slot = 512
    fid_size, embed_size = 101, 16

    num_slot = 512
    fid_size, embed_size = 101, 16

    embeddings = [
        tf.get_variable(
            'slot_emb{0}'.format(i), shape=[fid_size, embed_size],
            dtype=tf.float32,
            initializer=tf.random_uniform_initializer(-0.01, 0.01))
        for i in range(num_slot)]

    embed_output = tf.concat(
        [
            tf.nn.embedding_lookup_sparse(
                embeddings[i], x['x_{}'.format(i)], sp_weights=None,
                combiner='mean')
            for i in range(512)],
        axis=1)

    output_size = num_slot * embed_size
    fc1_size, fc2_size = 256, 64
    w1l = tf.get_variable(
        'w1l', shape=[output_size, fc1_size], dtype=tf.float32,
        initializer=tf.random_uniform_initializer(-0.01, 0.01))
    b1l = tf.get_variable(
        'b1l', shape=[fc1_size], dtype=tf.float32,
        initializer=tf.zeros_initializer())
    w2 = tf.get_variable(
        'w2', shape=[fc1_size, fc2_size], dtype=tf.float32,
        initializer=tf.random_uniform_initializer(-0.01, 0.01))
    b2 = tf.get_variable(
        'b2', shape=[fc2_size], dtype=tf.float32,
        initializer=tf.zeros_initializer())
    w3 = tf.get_variable(
        'w3', shape=[fc2_size*2, 2], dtype=tf.float32,
        initializer=tf.random_uniform_initializer(-0.01, 0.01))

    act1_l = tf.nn.relu(tf.nn.bias_add(tf.matmul(embed_output, w1l), b1l))
    act2_l = tf.nn.bias_add(tf.matmul(act1_l, w2), b2)

    if mode == tf.estimator.ModeKeys.TRAIN:
        act1_f = model.recv('act1_f', tf.float32, require_grad=True)
    elif mode == tf.estimator.ModeKeys.EVAL:
        act1_f = model.recv('act1_f', tf.float32, require_grad=False)
    else:
        act1_f = features['act1_f']

    output = tf.concat([act2_l, act1_f], axis=1)
    logits = tf.matmul(output, w3)


    if mode == tf.estimator.ModeKeys.PREDICT:
        return model.make_spec(mode, predictions=logits)

    y = labels['y']
    loss = tf.nn.sparse_softmax_cross_entropy_with_logits(
        labels=y, logits=logits)
    loss = tf.math.reduce_mean(loss)

    if mode == tf.estimator.ModeKeys.EVAL:
        auc_pair = tf.metrics.auc(y, logits[:, 1])
        return model.make_spec(
            mode, loss=loss, eval_metric_ops={'auc': auc_pair})

    # mode == tf.estimator.ModeKeys.TRAIN:
    logging_hook = tf.train.LoggingTensorHook(
        {"loss" : loss}, every_n_iter=10)
    metric_hook = flt.GlobalStepMetricTensorHook(tensor_dict={"loss": loss},
                                                 every_steps=10)
    final_ops = final_fn(model=model, tensor_name='reflux_embedding',
                         is_send=True, tensor=embeddings)
    embedding_hook = tf.train.FinalOpsHook(final_ops=final_ops)

    optimizer = tf.train.GradientDescentOptimizer(0.1)

    train_op = model.minimize(optimizer, loss, global_step=global_step)
    return model.make_spec(mode, loss=loss, train_op=train_op,
                           training_chief_hooks=[embedding_hook],
                           training_hooks=[logging_hook, metric_hook])
Model Builder of wide&deep learning models
    Args:
    Returns
    
example/wide_n_deep/leader.py