Coverage for mlprodict/onnxrt/ops_cpu/op_sum.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 OpRun
10class Sum(OpRun):
12 def __init__(self, onnx_node, desc=None, **options):
13 OpRun.__init__(self, onnx_node, desc=desc, **options)
15 def _run(self, *args): # pylint: disable=W0221
16 return (sum(args), )
18 def _infer_shapes(self, *args): # pylint: disable=W0221
19 return (args[0], )
21 def _infer_types(self, *args): # pylint: disable=W0221
22 return (args[0], )
24 def _infer_sizes(self, *args, **kwargs):
25 res = self.run(*args, **kwargs)
26 return (dict(temp=0), ) + res
28 def to_python(self, inputs):
29 return None, "return sum([%s])" % ", ".join(inputs)