Coverage for mlprodict/onnxrt/ops_cpu/op_sequence_insert.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

19 statements  

1# -*- encoding: utf-8 -*- 

2# pylint: disable=E0203,E1101,C0111 

3""" 

4@file 

5@brief Runtime operator. 

6 

7.. versionadded:: 0.7 

8""" 

9from ._op import OpRun 

10 

11 

12class SequenceInsert(OpRun): 

13 

14 atts = {'axis': 0, 'new_axis': 0} 

15 

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

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

18 atts=SequenceInsert.atts, **options) 

19 

20 def _run(self, S, T, ind=None): # pylint: disable=W0221 

21 S = S.copy() 

22 if ind is not None: 

23 S.insert(ind[0], T) 

24 else: 

25 S.append(T) 

26 return (S, ) 

27 

28 def _infer_shapes(self, S, T, ind=None): # pylint: disable=W0221 

29 return (S, ) 

30 

31 def _infer_types(self, S, T, ind=None): # pylint: disable=W0221 

32 return (S, ) 

33 

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

35 res = self.run(*args) 

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