def call(self, outputs, sequence_length=None, axis=1): x = melt.top_k_pooling(outputs, self.top_k, sequence_length, axis).values x = tf.reduce_sum(x * self.w, -1) return x
def call(self, outputs, sequence_length=None, axis=1): x = melt.top_k_pooling(outputs, self.top_k, sequence_length, axis).values x = tf.transpose(x, [0, 2, 1]) x = self.att(x) return x
def call(self, outputs, sequence_length=None, axis=1): x = melt.top_k_pooling(outputs, self.top_k, sequence_length, axis).values return tf.reshape(x, [-1, melt.get_shape(outputs, -1) * self.top_k])