def EmbeddingLookupFeatures(params, sparse_features, allow_weights):
 if (not isinstance(params, list)):
  params = [params]
 sparse_features = tf.convert_to_tensor(sparse_features)
 (indices, ids, weights) = gen_parser_ops.unpack_sparse_features(sparse_features)
 embeddings = tf.nn.embedding_lookup(params, ids)
 if allow_weights:
  broadcast_weights_shape = tf.concat(0, [tf.shape(weights), [1]])
  embeddings *= tf.reshape(weights, broadcast_weights_shape)
 return tf.unsorted_segment_sum(embeddings, indices, tf.size(sparse_features))

def EmbeddingLookupFeatures ( params , sparse_features , allow_weights ) : if ( not isinstance ( params , list ) ) : params = [ params ] sparse_features = tf . convert_to_tensor ( sparse_features ) ( indices , ids , weights ) = gen_parser_ops . unpack_sparse_features ( sparse_features ) embeddings = tf . nn . embedding_lookup ( params , ids ) if allow_weights : broadcast_weights_shape = tf . concat ( 0 , [ tf . shape ( weights ) , [ 1 ] ] ) embeddings *= tf . reshape ( weights , broadcast_weights_shape ) return tf . unsorted_segment_sum ( embeddings , indices , tf . size ( sparse_features ) )
computes embeddings for each entry of sparse features sparse_features .