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

Method _check_nargs

backends/mlx/pattern_utils.py:180–189  ·  view source on GitHub ↗

Check if node has the required number of args.

(self, node: Node)

Source from the content-addressed store, hash-verified

178 return True
179
180 def _check_nargs(self, node: Node) -> bool:
181 """Check if node has the required number of args."""
182 n = len(node.args)
183 if isinstance(self.nargs, tuple):
184 min_args, max_args = self.nargs
185 # Must be in range AND enough to access arg_index
186 return min_args <= n <= max_args and n > self.arg_index
187 else:
188 # Must have at least nargs, AND enough to access arg_index
189 return n >= self.nargs and n > self.arg_index
190
191 def _check_kwargs(self, node: Node) -> bool:
192 """Check that node's kwargs are all declared in self.kwargs (no unhandled kwargs)."""

Callers 1

matchesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected