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

17 statements  

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 

10 

11 

12class Range(OpRun): 

13 

14 atts = {} 

15 

16 def __init__(self, onnx_node, desc=None, **options): 

17 OpRun.__init__(self, onnx_node, desc=desc, 

18 expected_attributes=Range.atts, 

19 **options) 

20 

21 def _run(self, starts, ends, steps): # pylint: disable=W0221 

22 return (numpy.arange(starts, ends, steps).astype(starts.dtype), ) 

23 

24 def _infer_shapes(self, starts, ends, steps): # pylint: disable=W0221 

25 return (ShapeObject(None, starts.dtype), ) 

26 

27 def _infer_types(self, starts, ends, steps): # pylint: disable=W0221 

28 return (starts, ) 

29 

30 def _infer_sizes(self, *args, **kwargs): # pylint: disable=W0221 

31 res = self.run(*args, **kwargs) 

32 return (dict(temp=0), ) + res