Coverage for mlprodict/onnxrt/ops_cpu/op_range.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"""
7import numpy
8from ..shape_object import ShapeObject
9from ._op import OpRun
12class Range(OpRun):
14 atts = {}
16 def __init__(self, onnx_node, desc=None, **options):
17 OpRun.__init__(self, onnx_node, desc=desc,
18 expected_attributes=Range.atts,
19 **options)
21 def _run(self, starts, ends, steps): # pylint: disable=W0221
22 return (numpy.arange(starts, ends, steps).astype(starts.dtype), )
24 def _infer_shapes(self, starts, ends, steps): # pylint: disable=W0221
25 return (ShapeObject(None, starts.dtype), )
27 def _infer_types(self, starts, ends, steps): # pylint: disable=W0221
28 return (starts, )
30 def _infer_sizes(self, *args, **kwargs): # pylint: disable=W0221
31 res = self.run(*args, **kwargs)
32 return (dict(temp=0), ) + res