Checks correctness of inputs and kwargs and runs the backend operator.
(self, inputs, kwargs)
| 615 | return old_collection[position] |
| 616 | |
| 617 | def run(self, inputs, kwargs): |
| 618 | """Checks correctness of inputs and kwargs and runs the backend operator.""" |
| 619 | self._check_arg_len(self._expected_inputs_size, len(inputs), "inputs") |
| 620 | self._check_arg_len(len(self._kwargs_classification), len(kwargs), "keyword arguments") |
| 621 | |
| 622 | # TODO(klecki): Tis will work only with DataNodes |
| 623 | if _conditionals.conditionals_enabled(): |
| 624 | inputs, kwargs = _conditionals.apply_conditional_split_to_args(inputs, kwargs) |
| 625 | input_data_nodes_bkp = inputs |
| 626 | |
| 627 | call_args = {} |
| 628 | inputs = list(inputs) |
| 629 | |
| 630 | # Check inputs classification as batches and extract data from DataNodeDebugs. |
| 631 | for i, (input, expected_classification) in enumerate( |
| 632 | zip(inputs, self._inputs_classification) |
| 633 | ): |
| 634 | classification = _Classification(input, f"Input {i}") |
| 635 | expected_classification = self._update_classification( |
| 636 | self._inputs_classification, i, classification |
| 637 | ) |
| 638 | |
| 639 | self._check_batch_classification( |
| 640 | expected_classification.is_batch, classification.is_batch, "Input", i |
| 641 | ) |
| 642 | self._check_device_classification( |
| 643 | expected_classification.device, classification.device, "Input", i |
| 644 | ) |
| 645 | |
| 646 | if classification.is_batch: |
| 647 | if self.op_helper.schema_name != "_conditional__Merge": |
| 648 | self._check_batch_size(classification, i) |
| 649 | self._check_call_arg_meta_data( |
| 650 | expected_classification.data, classification.data, "Input", i |
| 651 | ) |
| 652 | |
| 653 | if classification.device != ("gpu" if self._device == "gpu" else "cpu"): |
| 654 | raise RuntimeError( |
| 655 | f"Cannot call {self._device.upper()} operator '{self._op_name}' with " |
| 656 | f"{classification.device.upper()} input {i}." |
| 657 | ) |
| 658 | |
| 659 | inputs[i] = classification.data |
| 660 | |
| 661 | input_sets = self._prep_input_sets(inputs) |
| 662 | |
| 663 | # Check kwargs classification as batches and setup call args. |
| 664 | for key, value in kwargs.items(): |
| 665 | classification = _Classification( |
| 666 | value, f"Argument {key}", arg_constant_len=self._batch_size |
| 667 | ) |
| 668 | |
| 669 | self._update_classification(self._kwargs_classification, key, classification) |
| 670 | |
| 671 | self._check_batch_classification( |
| 672 | self._kwargs_classification[key].is_batch, classification.is_batch, "Argument", key |
| 673 | ) |
| 674 | self._check_device_classification( |
nothing calls this directly
no test coverage detected