Coverage for mlprodict/onnxrt/ops_cpu/op_yield_op.py: 100%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
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 "Unable to find a schema for operator '{}'.".format(op_name))
27 def _run(self, a): # 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 "", "return %s.copy()" % inputs[0]
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 = {}