Belle II Software development
RelationalReasoning Class Reference
Inheritance diagram for RelationalReasoning:

Public Member Functions

def __init__ (self, num_layers, hidden_dim, **block_args)
 Constructor.
 
def forward (self, x)
 forward
 
def get_attention_maps (self, x)
 get attention maps
 

Public Attributes

 layers
 layers
 
 norm
 normalization
 

Detailed Description

RelationalReasoning

Definition at line 959 of file ieagan.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  num_layers,
  hidden_dim,
**  block_args 
)

Constructor.

Definition at line 963 of file ieagan.py.

963 def __init__(self, num_layers, hidden_dim, **block_args):
964 super().__init__()
965
966 self.layers = nn.ModuleList(
967 [EncoderBlock(**block_args) for _ in range(num_layers)]
968 )
969
970 self.norm = nn.LayerNorm(hidden_dim)
971

Member Function Documentation

◆ forward()

def forward (   self,
  x 
)

forward

Definition at line 973 of file ieagan.py.

973 def forward(self, x):
974 for layer in self.layers:
975 x = layer(x)
976
977 x = self.norm(x)
978 return x
979

◆ get_attention_maps()

def get_attention_maps (   self,
  x 
)

get attention maps

Definition at line 981 of file ieagan.py.

981 def get_attention_maps(self, x):
982 attention_maps = []
983 for layer in self.layers:
984 _, attn_map = layer.self_attn(x, return_attention=True)
985 attention_maps.append(attn_map)
986 x = layer(x)
987 return attention_maps
988
989

Member Data Documentation

◆ layers

layers

layers

Definition at line 966 of file ieagan.py.

◆ norm

norm

normalization

Definition at line 970 of file ieagan.py.


The documentation for this class was generated from the following file: