tensorflow如何加载模型?

#https://blog.csdn.net/huachao1001/article/details/78501928
import data01
import tensorflow as tf
import numpy as np

# 读入测试数据
# 导入数据
print("loading data... ")
X_train, y_train = data01.get_mstar_data("train", 64, 64, 96)
X_test, y_test = data01.get_mstar_data("test", 64, 64, 96)

X_train = np.reshape(X_train, [X_train.shape[0], X_train.shape[1] * X_train.shape[2]])
X_test = np.reshape(X_test, [X_test.shape[0], X_test.shape[1] * X_test.shape[2]])
print(X_train.shape, y_train.shape)
print(X_test.shape, y_test.shape)

print("shuffling ... ")
X_train, y_train = data01.data_shuffle(X_train, y_train)
X_test, y_test = data01.data_shuffle(X_test, y_test)

print("one_hot ...")
y_train, y_test = data01.one_hot(y_train, y_test)
print(y_train.shape)
print(y_test.shape)

# 将每一张图片用一个64x64的矩阵表示
X_train = X_train.reshape(-1, 64, 64, 1)
X_test = X_test.reshape(-1, 64, 64, 1)
print(X_train.shape)
print(X_test.shape)

# 主要的程序
with tf.Session() as sess:

    # 1.先加载图和参数变量
    saver = tf.train.import_meta_graph(\'model/sar10.ckpt.meta\')
    saver.restore(sess, tf.train.latest_checkpoint(\'model/\'))

    # 2.访问placeholders变量,并且创建feed-dict来作为placeholders的新值
    graph = tf.get_default_graph()
    X = graph.get_tensor_by_name("X:0")
    Y = graph.get_tensor_by_name("Y:0")
    feed_dict = {X:X_test,Y: y_test}

    # 接下来,访问你想要执行的op
    predict_op = graph.get_tensor_by_name("predict_op:0")
    corr_te = np.mean(np.argmax(y_test, axis=1) == sess.run(predict_op, feed_dict=feed_dict))