class_docstr: Implementation of a self-attention block as described by reference: https://arxiv.org/abs/1805.08318
  
  This block can then be used for 2d data (images), to compute the self attention. If two out_keys are given, the
  actual attention is returned from the forward pass with the second out_key. Otherwise only the computed
  self-attention is returned
  
  :param in_keys: Keys identifying the input tensors. First key is self_attention output, second optional key is
      attention mask.
  :param out_keys: Keys identifying the output tensors. First key is self-attention output, second optional key is
      attention map.
  :param in_shapes: List of input shapes.
  :param embed_dim: The embedding dimensionality, which should be an even fraction of the input channels.
  :param add_input_to_output: Specifies weather the computed self attention is added to the input and returned.
  :param bias: Specify weather to use a bias in the projections.
class_docstr_tok: ["Implementation","of","a","self-attention","block","as","described","by","reference",":","https",":","\/\/arxiv.org\/abs\/1805.08318","This","block","can","then","be","used","for","2d","data","(","images",")",",","to","compute","the","self","attention",".","If","two","out_keys","are","given",",","the","actual","attention","is","returned","from","the","forward","pass","with","the","second","out_key",".","Otherwise","only","the","computed","self-attention","is","returned",":","param","in_keys",":","Keys","identifying","the","input","tensors",".","First","key","is","self_attention","output",",","second","optional","key","is","attention","mask",".",":","param","out_keys",":","Keys","identifying","the","output","tensors",".","First","key","is","self-attention","output",",","second","optional","key","is","attention","map",".",":","param","in_shapes",":","List","of","input","shapes",".",":","param","embed_dim",":","The","embedding","dimensionality",",","which","should","be","an","even","fraction","of","the","input","channels",".",":","param","add_input_to_output",":","Specifies","weather","the","computed","self","attention","is","added","to","the","input","and","returned",".",":","param","bias",":","Specify","weather","to","use","a","bias","in","the","projections","."]
code: def __repr__(self):
      txt = f"{self.__class__.__name__}"
      txt += f"\n\tembed_dim: {self.embedding_dim}"
      txt += f"\n\tdropout: {self.dropout}"
      txt += f"\n\tbias: {self.query_conv.bias is not None}"
      txt += f"\n\tadd_input_to_output: {self.add_input_to_output}"
      txt += f"\n\tuse_attn_mask: {len(self.in_keys) > 1}"
      txt += f"\n\tOut Shapes: {self.out_shapes()}"
      return txt
  
file_path: maze/maze/perception/blocks/general/self_attention_conv.py
imports: from typing import Union, List, Sequence, Dict, Optional
  import numpy
  import torch
  from torch import nn
  from maze.core.annotations import override
  from maze.perception.blocks.base import PerceptionBlock
label_desc: Use image node_id 3 for calling the SelfAttentionConvBlock obj's underlying member method code with example usage: obj.__repr__() and returns: txt