(name: tuple | str, s_input_dims: tuple | None, c_dim: int, num_heads: int)
| 127 | |
| 128 | |
| 129 | def get_rel_pos_embedding_layer(name: tuple | str, s_input_dims: tuple | None, c_dim: int, num_heads: int): |
| 130 | embedding_name, embedding_args = split_args(name) |
| 131 | embedding_type = RelPosEmbedding[embedding_name] |
| 132 | # create a dictionary with the default values which can be overridden by embedding_args |
| 133 | kw_args = {"s_input_dims": s_input_dims, "c_dim": c_dim, "num_heads": num_heads, **embedding_args} |
| 134 | # filter out unused argument names |
| 135 | kw_args = {k: v for k, v in kw_args.items() if has_option(embedding_type, k)} |
| 136 | |
| 137 | return embedding_type(**kw_args) |
no test coverage detected
searching dependent graphs…