import tensorflow as tf; import numpy as np; c = np.random.random([10, 1]) b = tf.nn.embedding_lookup(c, [1, 3]) with tf.Session() as sess: sess.run(tf.global_variables_initializer()) print(sess.run(b))
下面是上面代码的输出结果:
2018-02-17 11:27:56.146080: I C: f_jenkinsworkspace el-winMwindowsPY35 ensorflowcoreplatformcpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2 [[ 0.09944958] [ 0.0264075 ]]