RelationalReasoning
Definition at line 959 of file ieagan.py.
◆ __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
◆ forward()
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
◆ layers
◆ norm
The documentation for this class was generated from the following file:
- pxd/scripts/pxd/background_generator/models/ieagan.py