MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / get_rel_pos_embedding_layer

Function get_rel_pos_embedding_layer

monai/networks/layers/utils.py:129–137  ·  view source on GitHub ↗
(name: tuple | str, s_input_dims: tuple | None, c_dim: int, num_heads: int)

Source from the content-addressed store, hash-verified

127
128
129def 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)

Callers 2

__init__Method · 0.90
__init__Method · 0.90

Calls 2

split_argsFunction · 0.90
has_optionFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…