MCPcopy Create free account
hub / github.com/pytorch/executorch / require_kwargs

Function require_kwargs

backends/mlx/ops.py:246–263  ·  view source on GitHub ↗

Validate that only allowed kwargs are present. Raises ValueError if unexpected kwargs are found. Args: kwargs: The handler kwargs dict allowed: Set of allowed kwarg names op_name: Name of the operation (for error message)

(
    kwargs: Dict[str, Any],
    allowed: Set[str],
    op_name: str,
)

Source from the content-addressed store, hash-verified

244
245
246def require_kwargs(
247 kwargs: Dict[str, Any],
248 allowed: Set[str],
249 op_name: str,
250) -> None:
251 """
252 Validate that only allowed kwargs are present.
253
254 Raises ValueError if unexpected kwargs are found.
255
256 Args:
257 kwargs: The handler kwargs dict
258 allowed: Set of allowed kwarg names
259 op_name: Name of the operation (for error message)
260 """
261 unexpected = set(kwargs.keys()) - allowed
262 if unexpected:
263 raise ValueError(f"{op_name}: unexpected kwargs: {unexpected}")
264
265
266def require_contiguous_format(

Callers 15

handlerFunction · 0.85
_isnan_handlerFunction · 0.85
_linear_handlerFunction · 0.85
_addmm_handlerFunction · 0.85
_mm_handlerFunction · 0.85
_view_handlerFunction · 0.85
_clone_handlerFunction · 0.85
_copy_handlerFunction · 0.85
_dim_order_clone_handlerFunction · 0.85
_dim_order_copy_handlerFunction · 0.85
_to_copy_handlerFunction · 0.85
_embedding_handlerFunction · 0.85

Calls 1

keysMethod · 0.80

Tested by

no test coverage detected