def model(args, train_env, infer_env):
    tf.reset_default_graph()
    train_graph = tf.Graph()
    infer_graph = tf.Graph()
    with train_graph.as_default():
        train_env.x = tf.placeholder(tf.int32, shape=[None, args.maxlen], name='x')
        train_env.y = tf.placeholder(tf.int32, (None, args.maxlen), name='y')
        train_env.training = tf.placeholder_with_default(False, (), name='train_mode')
        (train_env.train_op, train_env.loss, train_env.acc, sample_ids, logits) = construct_graph('train', train_env, args)
        train_env.saver = tf.train.Saver()
    with infer_graph.as_default():
        infer_env.x = tf.placeholder(tf.int32, shape=[None, args.maxlen], name='x')
        infer_env.y = tf.placeholder(tf.int32, (None, args.maxlen), name='y')
        infer_env.training = tf.placeholder_with_default(False, (), name='train_mode')
        (_, infer_env.loss, infer_env.acc, infer_env.pred_ids, _) = construct_graph('infer', infer_env, args)
        infer_env.infer_saver = tf.train.Saver()
    return (train_graph, infer_graph)
def model(args, train_env, infer_env):
    tf.reset_default_graph()
    train_graph = tf.Graph()
    infer_graph = tf.Graph()
    with train_graph.as_default():
        train_env.x = tf.placeholder(tf.int32, shape=[None, args.maxlen], name='x')
        train_env.y = tf.placeholder(tf.int32, (None, args.maxlen), name='y')
        train_env.training = tf.placeholder_with_default(False, (), name='train_mode')
        (train_env.train_op, train_env.loss, train_env.acc, sample_ids, logits) = construct_graph('train', train_env, args)
        train_env.saver = tf.train.Saver()
    with infer_graph.as_default():
        infer_env.x = tf.placeholder(tf.int32, shape=[None, args.maxlen], name='x')
        infer_env.y = tf.placeholder(tf.int32, (None, args.maxlen), name='y')
        infer_env.training = tf.placeholder_with_default(False, (), name='train_mode')
        (_, infer_env.loss, infer_env.acc, infer_env.pred_ids, _) = construct_graph('infer', infer_env, args)
        infer_env.infer_saver = tf.train.Saver()
    return (train_graph, infer_graph)