Skip to content

Commit

Permalink
Note to remember that alignment after dot product
Browse files Browse the repository at this point in the history
  • Loading branch information
rolczynski committed Oct 27, 2020
1 parent a143286 commit 17a5607
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion aspect_based_sentiment_analysis/recognizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,24 @@ def __call__(
# TODO: Re-implementation
# cls_id, text_ids, aspect_id = self.get_indices(example)
#
# attentions = alignment.merge_input_attentions(
# output_batch.attentions[i],
# alignment=example.alignment,
# reduce=True
# )
# attention_grads = alignment.merge_input_attentions(
# attention_grads,
# alignment=example.alignment,
# reduce=True
# )
# threshold = 0.05
# round_decimals = 2
#
# product = attentions * attention_grads
# product = tf.abs(product)
# product = tf.reduce_sum(product, axis=(0, 1))
# # ... alignment
# attention_grads = alignment.merge_input(
# product, alignment=example.alignment)
# product = product.numpy()
#
# w = product[cls_id, text_ids]
Expand Down

0 comments on commit 17a5607

Please sign in to comment.