r""" Returns a lambda function that internally calls positional_encoding. Args: num_encoding_functions: Number of encoding functions used to compute a positional encoding (default: 6). include_input: Whether to include the input in the positional enco
(
num_encoding_functions: int = 6,
include_input: bool = True,
log_sampling: bool = True,
)
| 251 | |
| 252 | |
| 253 | def get_embedding_function( |
| 254 | num_encoding_functions: int = 6, |
| 255 | include_input: bool = True, |
| 256 | log_sampling: bool = True, |
| 257 | ): |
| 258 | r""" |
| 259 | Returns a lambda function that internally calls positional_encoding. |
| 260 | |
| 261 | Args: |
| 262 | num_encoding_functions: |
| 263 | Number of encoding functions used to compute a positional encoding (default: 6). |
| 264 | include_input: |
| 265 | Whether to include the input in the positional encoding (default: True). |
| 266 | log_sampling: |
| 267 | whether to sample the sinusoid frequencies in log scale. |
| 268 | |
| 269 | Returns: |
| 270 | A lambda function that convert input to positional encoding. |
| 271 | the output dimension is (*, dim_out), where |
| 272 | :math:`dim_{out} = d_{in} * include_input + num_encoding_functions * 2` |
| 273 | """ |
| 274 | return lambda x: positional_encoding( |
| 275 | x, num_encoding_functions, include_input, log_sampling |
| 276 | ) |
nothing calls this directly
no test coverage detected