Coverage for mlprodict/onnx_conv/onnx_ops/onnx_fft.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

41 statements  

1""" 

2@file 

3@brief Custom operators for FFT. 

4""" 

5import numpy 

6from skl2onnx.algebra.onnx_operator import OnnxOperator 

7 

8 

9class OnnxFFT_1(OnnxOperator): 

10 """ 

11 Defines a custom operator for FFT. 

12 """ 

13 

14 since_version = 1 

15 expected_inputs = [('A', 'T'), ('fft_length', numpy.int64)] 

16 expected_outputs = [('FFT', 'T')] 

17 input_range = [1, 2] 

18 output_range = [1, 1] 

19 is_deprecated = False 

20 domain = 'mlprodict' 

21 operator_name = 'FFT' 

22 past_version = {} 

23 

24 def __init__(self, *args, axis=-1, 

25 op_version=None, **kwargs): 

26 """ 

27 :param A: array or OnnxOperatorMixin 

28 :param fft_length: (optional) array or OnnxOperatorMixin (args) 

29 :param axis: axis 

30 :param op_version: opset version 

31 :param kwargs: additional parameter 

32 """ 

33 OnnxOperator.__init__( 

34 self, *args, axis=axis, 

35 op_version=op_version, **kwargs) 

36 

37 

38class OnnxFFT2D_1(OnnxOperator): 

39 """ 

40 Defines a custom operator for FFT2D. 

41 """ 

42 

43 since_version = 1 

44 expected_inputs = [('A', 'T'), ('fft_length', numpy.int64)] 

45 expected_outputs = [('FFT2D', 'T')] 

46 input_range = [1, 2] 

47 output_range = [1, 1] 

48 is_deprecated = False 

49 domain = 'mlprodict' 

50 operator_name = 'FFT2D' 

51 past_version = {} 

52 

53 def __init__(self, *args, axes=(-2, -1), 

54 op_version=None, **kwargs): 

55 """ 

56 :param A: array or OnnxOperatorMixin 

57 :param fft_length: (optional) array or OnnxOperatorMixin (args) 

58 :param axes: axes 

59 :param op_version: opset version 

60 :param kwargs: additional parameter 

61 """ 

62 OnnxOperator.__init__( 

63 self, *args, axes=axes, 

64 op_version=op_version, **kwargs) 

65 

66 

67class OnnxRFFT_1(OnnxOperator): 

68 """ 

69 Defines a custom operator for FFT. 

70 """ 

71 

72 since_version = 1 

73 expected_inputs = [('A', 'T'), ('fft_length', numpy.int64)] 

74 expected_outputs = [('RFFT', 'T')] 

75 input_range = [1, 2] 

76 output_range = [1, 1] 

77 is_deprecated = False 

78 domain = 'mlprodict' 

79 operator_name = 'RFFT' 

80 past_version = {} 

81 

82 def __init__(self, *args, axis=-1, 

83 op_version=None, **kwargs): 

84 """ 

85 :param A: array or OnnxOperatorMixin 

86 :param fft_length: (optional) array or OnnxOperatorMixin (args) 

87 :param axis: axis 

88 :param op_version: opset version 

89 :param kwargs: additional parameter 

90 """ 

91 OnnxOperator.__init__( 

92 self, *args, axis=axis, 

93 op_version=op_version, **kwargs) 

94 

95 

96OnnxFFT = OnnxFFT_1 

97OnnxFFT2D = OnnxFFT2D_1 

98OnnxRFFT = OnnxRFFT_1