Coverage for mlprodict/onnxrt/ops_cpu/op_yield_op.py: 100%
20 statements
« prev ^ index » next coverage.py v7.1.0, created at 2023-02-04 02:28 +0100
« prev ^ index » next coverage.py v7.1.0, created at 2023-02-04 02:28 +0100
1# -*- encoding: utf-8 -*-
2# pylint: disable=E0203,E1101,C0111
3"""
4@file
5@brief Runtime operator.
6"""
7from ._op import OpRunUnaryNum
8from ._new_ops import OperatorSchema
11class YieldOp(OpRunUnaryNum):
13 atts = {'full_shape_outputs': [],
14 'non_differentiable_outputs': []}
16 def __init__(self, onnx_node, desc=None, **options):
17 OpRunUnaryNum.__init__(self, onnx_node, desc=desc,
18 expected_attributes=YieldOp.atts,
19 **options)
21 def _find_custom_operator_schema(self, op_name):
22 if op_name == "YieldOp":
23 return YieldOpSchema()
24 raise RuntimeError( # pragma: no cover
25 f"Unable to find a schema for operator '{op_name}'.")
27 def _run(self, a, attributes=None, verbose=0, fLOG=None): # pylint: disable=W0221
28 if self.inplaces.get(0, False):
29 return (a, )
30 return (a.copy(), )
32 def to_python(self, inputs):
33 return "", f"return {inputs[0]}.copy()"
36class YieldOpSchema(OperatorSchema):
37 """
38 Defines a schema for operators added in this package
39 such as @see cl ComplexAbs.
40 """
42 def __init__(self):
43 OperatorSchema.__init__(self, 'YieldOp')
44 self.attributes = {}