我是python和Tensorflow的新手,我想初始化 k 矩阵(比方说k = 10)每个都是300X300,我写了这一行,但我不确定这是不是正确与否
$text = "I was eating at a restaurant.";
echo $text . "<br>";
$token = preg_replace('/([\.\,\(\)\'\"\!\?\:\;])/', " \\1", $text);
echo $token;
我将不胜感激任何帮助。
答案 0 :(得分:0)
这是正确的方法,但要注意变量 NOT 尚未初始化。当您实际运行初始化程序时,它会被初始化:
R = tf.Variable(tf.random_normal(shape=(10, 300, 300)),name="R")
init_op = tf.global_variables_initializer()
with tf.Seesion() as sess:
sess.run(init_op) # now R gets initialized
r = sess.run(R) # load value of R as numpy array r
# ... check r's value ...