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

Function require_args

backends/mlx/ops.py:221–243  ·  view source on GitHub ↗

Validate that args count is within expected range. Raises ValueError if the count is outside the expected range. Args: args: The handler args list min_count: Minimum number of args expected max_count: Maximum number of args expected op_name: Name of the

(
    args: List[Any],
    min_count: int,
    max_count: int,
    op_name: str,
)

Source from the content-addressed store, hash-verified

219
220
221def require_args(
222 args: List[Any],
223 min_count: int,
224 max_count: int,
225 op_name: str,
226) -> None:
227 """
228 Validate that args count is within expected range.
229
230 Raises ValueError if the count is outside the expected range.
231
232 Args:
233 args: The handler args list
234 min_count: Minimum number of args expected
235 max_count: Maximum number of args expected
236 op_name: Name of the operation (for error message)
237 """
238 if not (min_count <= len(args) <= max_count):
239 if min_count == max_count:
240 raise ValueError(f"{op_name}: expected {min_count} args, got {len(args)}")
241 raise ValueError(
242 f"{op_name}: expected {min_count}-{max_count} args, got {len(args)}"
243 )
244
245
246def require_kwargs(

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

no outgoing calls

Tested by

no test coverage detected