tf.nn.embedding_lookup TensorFlow embedding_lookup 函数最简单实例
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
params=np.random.normal(loc=0.0,scale=1.0,size=[10,10])
ids=[1,2,3]
with tf.Session() as sess:
print(sess.run(tf.nn.embedding_lookup(params,ids)))
http://www.tensorflownews.com/ 分享。