Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def build_branch(self, name, W_emb, bias):
- indices = tf.placeholder(tf.int64, shape=[None, 2], name=name + '__indices')
- values = tf.placeholder(tf.float32, shape=[None], name=name + '__values')
- dense_shape = tf.placeholder(tf.int64, shape=[2], name=name + '__dense_shape')
- sparse_input = tf.SparseTensor(indices, values, dense_shape)
- embedding = tf.nn.relu(tf.sparse_tensor_dense_matmul(sparse_input, W_emb) + bias)
- encoder = embedding
- for layer in self.layers:
- encoder = layer(encoder)
- return [indices, values, dense_shape], encoder
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement