我正在运行此nodejs函数,该函数查询impala查询并返回一些结果
import tensorflow as tf
def mean_var(x):
vec = tf.random_normal([x])
mean, variance = tf.nn.moments(vec, [0], keep_dims=True)
return mean, variance
with tf.Graph().as_default():
x = tf.placeholder(tf.int32)
output = mean_var(x)
init = tf.initialize_all_variables()
_ = tf.Variable(initial_value='fake_variable')
saver = tf.train.Saver()
with tf.Session() as sess:
sess.run(init)
sess.run(_.initializer)
#val = sess.run(output, feed_dict={x: 4})
#print(val[0], val[1])
save_path = saver.save(sess, "./mean_var.ckpt")
tf.reset_default_graph()
with tf.Graph().as_default():
init = tf.initialize_all_variables()
_ = tf.Variable(initial_value='fake_variable')
saver = tf.train.Saver()
with tf.Session() as sess:
sess.run(init)
sess.run(_.initializer)
saver.restore(sess, './mean_var.ckpt')
但是我的代码被卡住了,就像在“ resultset.toObjArray”上花费2-3分钟一样,对于具有大量行的查询没有错误, 同样,CPU会在此声明中使用100%的代码,有什么办法可以解决这个问题?