Process argument inputs: validate, deprecate, promote constants, add to spec and return the list of DataNodes that need to be kept alive for the graph to exist. Returns ------- List the list of DataNodes representing inputs (there may be conversions)
(schema, spec, kwargs, operator_name)
| 271 | |
| 272 | |
| 273 | def _process_argument_inputs(schema, spec, kwargs, operator_name): |
| 274 | """Process argument inputs: validate, deprecate, promote constants, add to spec and return the |
| 275 | list of DataNodes that need to be kept alive for the graph to exist. |
| 276 | |
| 277 | Returns |
| 278 | ------- |
| 279 | List |
| 280 | the list of DataNodes representing inputs (there may be conversions) |
| 281 | """ |
| 282 | kwargs = _handle_arg_deprecations(schema, kwargs, operator_name) |
| 283 | # Add argument inputs |
| 284 | result = [] |
| 285 | for k in sorted(kwargs.keys()): |
| 286 | arg_inp = kwargs[k] |
| 287 | if arg_inp is None: |
| 288 | continue |
| 289 | # Argument input constants are always placed on CPU |
| 290 | # TODO(klecki): For MIS we can extract this step outside and do it once |
| 291 | arg_inp = _handle_constant(arg_inp, "cpu", k, operator_name) |
| 292 | |
| 293 | if arg_inp.device != "cpu": |
| 294 | raise ValueError( |
| 295 | f"Invalid device \"{arg_inp.device}\" for argument '{k}' of operator " |
| 296 | f"'{operator_name}'. " |
| 297 | f"Named arguments must be on CPU." |
| 298 | ) |
| 299 | |
| 300 | _check_arg_input(schema, operator_name, k) |
| 301 | |
| 302 | spec.AddArgumentInput(k, arg_inp.name, arg_inp.ndim, arg_inp.dtype, arg_inp.layout) |
| 303 | result.append(arg_inp) |
| 304 | return result |
| 305 | |
| 306 | |
| 307 | def _process_inputs(schema, spec, inputs, operator_name): |
no test coverage detected