Coverage for mlprodict/onnxrt/ops_cpu/op_debug.py: 95%
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 OpRun
8from ._new_ops import OperatorSchema
11class DEBUG(OpRun):
13 atts = {}
15 def __init__(self, onnx_node, desc=None, **options):
16 OpRun.__init__(self, onnx_node, desc=desc,
17 **options)
19 def _run(self, a, *args, attributes=None, verbose=0, fLOG=None): # pylint: disable=W0221
20 if self.inplaces.get(0, False):
21 return (a, )
22 return (a.copy(), )
24 def to_python(self, inputs):
25 return "", f"return {inputs[0]}.copy()"
27 def _find_custom_operator_schema(self, op_name):
28 if op_name == "DEBUG":
29 return DEBUGSchema()
30 raise RuntimeError( # pragma: no cover
31 f"Unable to find a schema for operator '{op_name}'.")
34class DEBUGSchema(OperatorSchema):
35 """
36 Defines a schema for operators added in this package
37 such as @see cl Solve.
38 """
40 def __init__(self):
41 OperatorSchema.__init__(self, 'DEBUG')
42 self.attributes = DEBUG.atts