1be168c0dSopenharmony_ciFrom 881a1c16aeac375bb92d32e80d70239694d0b34b Mon Sep 17 00:00:00 2001
2be168c0dSopenharmony_ciFrom: chengfeng27 <chengfeng27@huawei.com>
3be168c0dSopenharmony_ciDate: Wed, 5 Jun 2024 19:33:58 +0800
4be168c0dSopenharmony_ciSubject: fix MindIR_ScatterElements_CreatePrimitive
5be168c0dSopenharmony_ci
6be168c0dSopenharmony_ci---
7be168c0dSopenharmony_ci mindspore/lite/mindir/BUILD.gn                |    2 +
8be168c0dSopenharmony_ci mindspore/lite/mindir/include/mindir.h        |  406 ++++
9be168c0dSopenharmony_ci mindspore/lite/mindir/include/mindir_tensor.h |    1 +
10be168c0dSopenharmony_ci mindspore/lite/mindir/include/mindir_types.h  |   60 +
11be168c0dSopenharmony_ci mindspore/lite/mindir/src/mindir.cc           |  106 +-
12be168c0dSopenharmony_ci mindspore/lite/mindir/src/mindir_1.cc         | 2061 ++++++++++++++++
13be168c0dSopenharmony_ci mindspore/lite/mindir/src/mindir_2.cc         | 2152 +++++++++++++++++
14be168c0dSopenharmony_ci mindspore/lite/mindir/src/mindir_tensor.cc    |   13 +
15be168c0dSopenharmony_ci 8 files changed, 4797 insertions(+), 4 deletions(-)
16be168c0dSopenharmony_ci create mode 100644 mindspore/lite/mindir/src/mindir_1.cc
17be168c0dSopenharmony_ci create mode 100644 mindspore/lite/mindir/src/mindir_2.cc
18be168c0dSopenharmony_ci
19be168c0dSopenharmony_cidiff --git a/mindspore/lite/mindir/BUILD.gn b/mindspore/lite/mindir/BUILD.gn
20be168c0dSopenharmony_ciindex ad4eff84..ec87d1da 100644
21be168c0dSopenharmony_ci--- a/mindspore/lite/mindir/BUILD.gn
22be168c0dSopenharmony_ci+++ b/mindspore/lite/mindir/BUILD.gn
23be168c0dSopenharmony_ci@@ -38,6 +38,8 @@ ohos_shared_library("mindir_lib") {
24be168c0dSopenharmony_ci   sources = [
25be168c0dSopenharmony_ci     "../src/common/log.cc",
26be168c0dSopenharmony_ci     "src/mindir.cc",
27be168c0dSopenharmony_ci+    "src/mindir_1.cc",
28be168c0dSopenharmony_ci+    "src/mindir_2.cc",
29be168c0dSopenharmony_ci     "src/mindir_memory_manager.cc",
30be168c0dSopenharmony_ci     "src/mindir_nnrt_lite_graph.cc",
31be168c0dSopenharmony_ci     "src/mindir_tensor.cc",
32be168c0dSopenharmony_cidiff --git a/mindspore/lite/mindir/include/mindir.h b/mindspore/lite/mindir/include/mindir.h
33be168c0dSopenharmony_ciindex 7eb3a744..d236b6cc 100644
34be168c0dSopenharmony_ci--- a/mindspore/lite/mindir/include/mindir.h
35be168c0dSopenharmony_ci+++ b/mindspore/lite/mindir/include/mindir.h
36be168c0dSopenharmony_ci@@ -666,6 +666,412 @@ PrimitivePtr MindIR_Rank_CreatePrimitive();
37be168c0dSopenharmony_ci // ********** GatherNd **********
38be168c0dSopenharmony_ci PrimitivePtr MindIR_GatherNd_CreatePrimitive();
39be168c0dSopenharmony_ci 
40be168c0dSopenharmony_ci+// ********** BatchToSpace **********
41be168c0dSopenharmony_ci+PrimitivePtr MindIR_BatchToSpace_CreatePrimitive(const std::vector<int64_t>& block_size, const std::vector<std::vector<int64_t>>& crops);
42be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_BatchToSpace_GetBlockSize(ConstPrimitivePtr primitive);
43be168c0dSopenharmony_ci+void MindIR_BatchToSpace_SetBlockSize(PrimitivePtr *primitive, const std::vector<int64_t>& block_size);
44be168c0dSopenharmony_ci+std::vector<std::vector<int64_t>> MindIR_BatchToSpace_GetCrops(ConstPrimitivePtr primitive);
45be168c0dSopenharmony_ci+void MindIR_BatchToSpace_SetCrops(PrimitivePtr *primitive, const std::vector<std::vector<int64_t>>& crops);
46be168c0dSopenharmony_ci+
47be168c0dSopenharmony_ci+// ********** Depend **********
48be168c0dSopenharmony_ci+PrimitivePtr MindIR_Depend_CreatePrimitive();
49be168c0dSopenharmony_ci+
50be168c0dSopenharmony_ci+// ********** Dropout **********
51be168c0dSopenharmony_ci+PrimitivePtr MindIR_Dropout_CreatePrimitive(float keep_prob);
52be168c0dSopenharmony_ci+float MindIR_Dropout_GetKeepProb(ConstPrimitivePtr primitive);
53be168c0dSopenharmony_ci+void MindIR_Dropout_SetKeepProb(PrimitivePtr *primitive, float keep_prob);
54be168c0dSopenharmony_ci+
55be168c0dSopenharmony_ci+// ********** Elu **********
56be168c0dSopenharmony_ci+PrimitivePtr MindIR_Elu_CreatePrimitive(float alpha);
57be168c0dSopenharmony_ci+float MindIR_Elu_GetAlpha(ConstPrimitivePtr primitive);
58be168c0dSopenharmony_ci+void MindIR_Elu_SetAlpha(PrimitivePtr *primitive, float alpha);
59be168c0dSopenharmony_ci+
60be168c0dSopenharmony_ci+// ********** EmbeddingLookupFusion **********
61be168c0dSopenharmony_ci+PrimitivePtr MindIR_EmbeddingLookupFusion_CreatePrimitive(float max_norm);
62be168c0dSopenharmony_ci+float MindIR_EmbeddingLookupFusion_GetMaxNorm(ConstPrimitivePtr primitive);
63be168c0dSopenharmony_ci+void MindIR_EmbeddingLookupFusion_SetMaxNorm(PrimitivePtr *primitive, float max_norm);
64be168c0dSopenharmony_ci+
65be168c0dSopenharmony_ci+// ********** FakeQuantWithMinMaxVars **********
66be168c0dSopenharmony_ci+PrimitivePtr MindIR_FakeQuantWithMinMaxVars_CreatePrimitive(int64_t num_bits, bool narrow_range);
67be168c0dSopenharmony_ci+int64_t MindIR_FakeQuantWithMinMaxVars_GetNumBits(ConstPrimitivePtr primitive);
68be168c0dSopenharmony_ci+void MindIR_FakeQuantWithMinMaxVars_SetNumBits(PrimitivePtr *primitive, int64_t num_bits);
69be168c0dSopenharmony_ci+bool MindIR_FakeQuantWithMinMaxVars_GetNarrowRange(ConstPrimitivePtr primitive);
70be168c0dSopenharmony_ci+void MindIR_FakeQuantWithMinMaxVars_SetNarrowRange(PrimitivePtr *primitive, bool narrow_range);
71be168c0dSopenharmony_ci+
72be168c0dSopenharmony_ci+// ********** FakeQuantWithMinMaxVarsPerChannel **********
73be168c0dSopenharmony_ci+PrimitivePtr MindIR_FakeQuantWithMinMaxVarsPerChannel_CreatePrimitive(int64_t num_bits, bool narrow_range);
74be168c0dSopenharmony_ci+int64_t MindIR_FakeQuantWithMinMaxVarsPerChannel_GetNumBits(ConstPrimitivePtr primitive);
75be168c0dSopenharmony_ci+void MindIR_FakeQuantWithMinMaxVarsPerChannel_SetNumBits(PrimitivePtr *primitive, int64_t num_bits);
76be168c0dSopenharmony_ci+bool MindIR_FakeQuantWithMinMaxVarsPerChannel_GetNarrowRange(ConstPrimitivePtr primitive);
77be168c0dSopenharmony_ci+void MindIR_FakeQuantWithMinMaxVarsPerChannel_SetNarrowRange(PrimitivePtr *primitive, bool narrow_range);
78be168c0dSopenharmony_ci+
79be168c0dSopenharmony_ci+// ********** FftReal **********
80be168c0dSopenharmony_ci+PrimitivePtr MindIR_FftReal_CreatePrimitive();
81be168c0dSopenharmony_ci+
82be168c0dSopenharmony_ci+// ********** FftImag **********
83be168c0dSopenharmony_ci+PrimitivePtr MindIR_FftImag_CreatePrimitive();
84be168c0dSopenharmony_ci+
85be168c0dSopenharmony_ci+// ********** FloorDiv **********
86be168c0dSopenharmony_ci+PrimitivePtr MindIR_FloorDiv_CreatePrimitive();
87be168c0dSopenharmony_ci+
88be168c0dSopenharmony_ci+// ********** FloorMod **********
89be168c0dSopenharmony_ci+PrimitivePtr MindIR_FloorMod_CreatePrimitive();
90be168c0dSopenharmony_ci+
91be168c0dSopenharmony_ci+// ********** HashtableLookup **********
92be168c0dSopenharmony_ci+PrimitivePtr MindIR_HashtableLookup_CreatePrimitive();
93be168c0dSopenharmony_ci+
94be168c0dSopenharmony_ci+// ********** LpNormalization **********
95be168c0dSopenharmony_ci+PrimitivePtr MindIR_LpNormalization_CreatePrimitive(int64_t axis, int64_t p);
96be168c0dSopenharmony_ci+int64_t MindIR_LpNormalization_GetAxis(ConstPrimitivePtr primitive);
97be168c0dSopenharmony_ci+void MindIR_LpNormalization_SetAxis(PrimitivePtr *primitive, int64_t axis);
98be168c0dSopenharmony_ci+int64_t MindIR_LpNormalization_GetP(ConstPrimitivePtr primitive);
99be168c0dSopenharmony_ci+void MindIR_LpNormalization_SetP(PrimitivePtr *primitive, int64_t p);
100be168c0dSopenharmony_ci+
101be168c0dSopenharmony_ci+// ********** LshProjection **********
102be168c0dSopenharmony_ci+PrimitivePtr MindIR_LshProjection_CreatePrimitive(LshProjectionType type);
103be168c0dSopenharmony_ci+LshProjectionType MindIR_LshProjection_GetType(ConstPrimitivePtr primitive);
104be168c0dSopenharmony_ci+void MindIR_LshProjection_SetType(PrimitivePtr *primitive, LshProjectionType type);
105be168c0dSopenharmony_ci+
106be168c0dSopenharmony_ci+// ********** SwitchLayer **********
107be168c0dSopenharmony_ci+PrimitivePtr MindIR_SwitchLayer_CreatePrimitive();
108be168c0dSopenharmony_ci+
109be168c0dSopenharmony_ci+// ********** Mfcc **********
110be168c0dSopenharmony_ci+PrimitivePtr MindIR_Mfcc_CreatePrimitive(float freq_upper_limit, float freq_lower_limit, int64_t filter_bank_channel_num, int64_t dct_coeff_num);
111be168c0dSopenharmony_ci+float MindIR_Mfcc_GetFreqUpperLimit(ConstPrimitivePtr primitive);
112be168c0dSopenharmony_ci+void MindIR_Mfcc_SetFreqUpperLimit(PrimitivePtr *primitive, float freq_upper_limit);
113be168c0dSopenharmony_ci+float MindIR_Mfcc_GetFreqLowerLimit(ConstPrimitivePtr primitive);
114be168c0dSopenharmony_ci+void MindIR_Mfcc_SetFreqLowerLimit(PrimitivePtr *primitive, float freq_lower_limit);
115be168c0dSopenharmony_ci+int64_t MindIR_Mfcc_GetFilterBankChannelNum(ConstPrimitivePtr primitive);
116be168c0dSopenharmony_ci+void MindIR_Mfcc_SetFilterBankChannelNum(PrimitivePtr *primitive, int64_t filter_bank_channel_num);
117be168c0dSopenharmony_ci+int64_t MindIR_Mfcc_GetDctCoeffNum(ConstPrimitivePtr primitive);
118be168c0dSopenharmony_ci+void MindIR_Mfcc_SetDctCoeffNum(PrimitivePtr *primitive, int64_t dct_coeff_num);
119be168c0dSopenharmony_ci+
120be168c0dSopenharmony_ci+// ********** NonMaxSuppression **********
121be168c0dSopenharmony_ci+PrimitivePtr MindIR_NonMaxSuppression_CreatePrimitive(int64_t center_point_box);
122be168c0dSopenharmony_ci+int64_t MindIR_NonMaxSuppression_GetCenterPointBox(ConstPrimitivePtr primitive);
123be168c0dSopenharmony_ci+void MindIR_NonMaxSuppression_SetCenterPointBox(PrimitivePtr *primitive, int64_t center_point_box);
124be168c0dSopenharmony_ci+
125be168c0dSopenharmony_ci+// ********** OnesLike **********
126be168c0dSopenharmony_ci+PrimitivePtr MindIR_OnesLike_CreatePrimitive();
127be168c0dSopenharmony_ci+
128be168c0dSopenharmony_ci+// ********** PartialFusion **********
129be168c0dSopenharmony_ci+PrimitivePtr MindIR_PartialFusion_CreatePrimitive(int64_t sub_graph_index);
130be168c0dSopenharmony_ci+int64_t MindIR_PartialFusion_GetSubGraphIndex(ConstPrimitivePtr primitive);
131be168c0dSopenharmony_ci+void MindIR_PartialFusion_SetSubGraphIndex(PrimitivePtr *primitive, int64_t sub_graph_index);
132be168c0dSopenharmony_ci+
133be168c0dSopenharmony_ci+// ********** PriorBox **********
134be168c0dSopenharmony_ci+PrimitivePtr MindIR_PriorBox_CreatePrimitive(const std::vector<int64_t>& min_sizes, const std::vector<int64_t>& max_sizes, const std::vector<float>& aspect_ratios, const std::vector<float>& variances, int64_t image_size_w, int64_t image_size_h, float step_w, float step_h, bool clip, bool flip, float offset);
135be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_PriorBox_GetMinSizes(ConstPrimitivePtr primitive);
136be168c0dSopenharmony_ci+void MindIR_PriorBox_SetMinSizes(PrimitivePtr *primitive, const std::vector<int64_t>& min_sizes);
137be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_PriorBox_GetMaxSizes(ConstPrimitivePtr primitive);
138be168c0dSopenharmony_ci+void MindIR_PriorBox_SetMaxSizes(PrimitivePtr *primitive, const std::vector<int64_t>& max_sizes);
139be168c0dSopenharmony_ci+std::vector<float> MindIR_PriorBox_GetAspectRatios(ConstPrimitivePtr primitive);
140be168c0dSopenharmony_ci+void MindIR_PriorBox_SetAspectRatios(PrimitivePtr *primitive, const std::vector<float>& aspect_ratios);
141be168c0dSopenharmony_ci+std::vector<float> MindIR_PriorBox_GetVariances(ConstPrimitivePtr primitive);
142be168c0dSopenharmony_ci+void MindIR_PriorBox_SetVariances(PrimitivePtr *primitive, const std::vector<float>& variances);
143be168c0dSopenharmony_ci+int64_t MindIR_PriorBox_GetImageSizeW(ConstPrimitivePtr primitive);
144be168c0dSopenharmony_ci+void MindIR_PriorBox_SetImageSizeW(PrimitivePtr *primitive, int64_t image_size_w);
145be168c0dSopenharmony_ci+int64_t MindIR_PriorBox_GetImageSizeH(ConstPrimitivePtr primitive);
146be168c0dSopenharmony_ci+void MindIR_PriorBox_SetImageSizeH(PrimitivePtr *primitive, int64_t image_size_h);
147be168c0dSopenharmony_ci+float MindIR_PriorBox_GetStepW(ConstPrimitivePtr primitive);
148be168c0dSopenharmony_ci+void MindIR_PriorBox_SetStepW(PrimitivePtr *primitive, float step_w);
149be168c0dSopenharmony_ci+float MindIR_PriorBox_GetStepH(ConstPrimitivePtr primitive);
150be168c0dSopenharmony_ci+void MindIR_PriorBox_SetStepH(PrimitivePtr *primitive, float step_h);
151be168c0dSopenharmony_ci+bool MindIR_PriorBox_GetClip(ConstPrimitivePtr primitive);
152be168c0dSopenharmony_ci+void MindIR_PriorBox_SetClip(PrimitivePtr *primitive, bool clip);
153be168c0dSopenharmony_ci+bool MindIR_PriorBox_GetFlip(ConstPrimitivePtr primitive);
154be168c0dSopenharmony_ci+void MindIR_PriorBox_SetFlip(PrimitivePtr *primitive, bool flip);
155be168c0dSopenharmony_ci+float MindIR_PriorBox_GetOffset(ConstPrimitivePtr primitive);
156be168c0dSopenharmony_ci+void MindIR_PriorBox_SetOffset(PrimitivePtr *primitive, float offset);
157be168c0dSopenharmony_ci+
158be168c0dSopenharmony_ci+// ********** ReverseSequence **********
159be168c0dSopenharmony_ci+PrimitivePtr MindIR_ReverseSequence_CreatePrimitive(int64_t seq_dim, int64_t batch_dim);
160be168c0dSopenharmony_ci+int64_t MindIR_ReverseSequence_GetSeqDim(ConstPrimitivePtr primitive);
161be168c0dSopenharmony_ci+void MindIR_ReverseSequence_SetSeqDim(PrimitivePtr *primitive, int64_t seq_dim);
162be168c0dSopenharmony_ci+int64_t MindIR_ReverseSequence_GetBatchDim(ConstPrimitivePtr primitive);
163be168c0dSopenharmony_ci+void MindIR_ReverseSequence_SetBatchDim(PrimitivePtr *primitive, int64_t batch_dim);
164be168c0dSopenharmony_ci+
165be168c0dSopenharmony_ci+// ********** ReverseV2 **********
166be168c0dSopenharmony_ci+PrimitivePtr MindIR_ReverseV2_CreatePrimitive(const std::vector<int64_t>& axis);
167be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_ReverseV2_GetAxis(ConstPrimitivePtr primitive);
168be168c0dSopenharmony_ci+void MindIR_ReverseV2_SetAxis(PrimitivePtr *primitive, const std::vector<int64_t>& axis);
169be168c0dSopenharmony_ci+
170be168c0dSopenharmony_ci+// ********** Rfft **********
171be168c0dSopenharmony_ci+PrimitivePtr MindIR_Rfft_CreatePrimitive(int64_t fft_length);
172be168c0dSopenharmony_ci+int64_t MindIR_Rfft_GetFftLength(ConstPrimitivePtr primitive);
173be168c0dSopenharmony_ci+void MindIR_Rfft_SetFftLength(PrimitivePtr *primitive, int64_t fft_length);
174be168c0dSopenharmony_ci+
175be168c0dSopenharmony_ci+// ********** ROIPooling **********
176be168c0dSopenharmony_ci+PrimitivePtr MindIR_ROIPooling_CreatePrimitive(int64_t pooled_h, int64_t pooled_w, float scale);
177be168c0dSopenharmony_ci+int64_t MindIR_ROIPooling_GetPooledH(ConstPrimitivePtr primitive);
178be168c0dSopenharmony_ci+void MindIR_ROIPooling_SetPooledH(PrimitivePtr *primitive, int64_t pooled_h);
179be168c0dSopenharmony_ci+int64_t MindIR_ROIPooling_GetPooledW(ConstPrimitivePtr primitive);
180be168c0dSopenharmony_ci+void MindIR_ROIPooling_SetPooledW(PrimitivePtr *primitive, int64_t pooled_w);
181be168c0dSopenharmony_ci+float MindIR_ROIPooling_GetScale(ConstPrimitivePtr primitive);
182be168c0dSopenharmony_ci+void MindIR_ROIPooling_SetScale(PrimitivePtr *primitive, float scale);
183be168c0dSopenharmony_ci+
184be168c0dSopenharmony_ci+// ********** SkipGram **********
185be168c0dSopenharmony_ci+PrimitivePtr MindIR_SkipGram_CreatePrimitive(bool include_all_grams, int64_t max_skip_size, int64_t ngram_size);
186be168c0dSopenharmony_ci+bool MindIR_SkipGram_GetIncludeAllGrams(ConstPrimitivePtr primitive);
187be168c0dSopenharmony_ci+void MindIR_SkipGram_SetIncludeAllGrams(PrimitivePtr *primitive, bool include_all_grams);
188be168c0dSopenharmony_ci+int64_t MindIR_SkipGram_GetMaxSkipSize(ConstPrimitivePtr primitive);
189be168c0dSopenharmony_ci+void MindIR_SkipGram_SetMaxSkipSize(PrimitivePtr *primitive, int64_t max_skip_size);
190be168c0dSopenharmony_ci+int64_t MindIR_SkipGram_GetNgramSize(ConstPrimitivePtr primitive);
191be168c0dSopenharmony_ci+void MindIR_SkipGram_SetNgramSize(PrimitivePtr *primitive, int64_t ngram_size);
192be168c0dSopenharmony_ci+
193be168c0dSopenharmony_ci+// ********** Switch **********
194be168c0dSopenharmony_ci+PrimitivePtr MindIR_Switch_CreatePrimitive();
195be168c0dSopenharmony_ci+
196be168c0dSopenharmony_ci+// ********** Unique **********
197be168c0dSopenharmony_ci+PrimitivePtr MindIR_Unique_CreatePrimitive();
198be168c0dSopenharmony_ci+
199be168c0dSopenharmony_ci+// ********** UnsortedSegmentSum **********
200be168c0dSopenharmony_ci+PrimitivePtr MindIR_UnsortedSegmentSum_CreatePrimitive();
201be168c0dSopenharmony_ci+
202be168c0dSopenharmony_ci+// ********** ZerosLike **********
203be168c0dSopenharmony_ci+PrimitivePtr MindIR_ZerosLike_CreatePrimitive();
204be168c0dSopenharmony_ci+
205be168c0dSopenharmony_ci+// ********** GRU **********
206be168c0dSopenharmony_ci+PrimitivePtr MindIR_GRU_CreatePrimitive( bool bidirectional);
207be168c0dSopenharmony_ci+bool MindIR_GRU_GetBidirectional(ConstPrimitivePtr primitive);
208be168c0dSopenharmony_ci+void MindIR_GRU_SetBidirectional(PrimitivePtr *primitive, bool bidirectional);
209be168c0dSopenharmony_ci+
210be168c0dSopenharmony_ci+// ********** NonZero **********
211be168c0dSopenharmony_ci+PrimitivePtr MindIR_NonZero_CreatePrimitive();
212be168c0dSopenharmony_ci+
213be168c0dSopenharmony_ci+// ********** InvertPermutation **********
214be168c0dSopenharmony_ci+PrimitivePtr MindIR_InvertPermutation_CreatePrimitive();
215be168c0dSopenharmony_ci+
216be168c0dSopenharmony_ci+// ********** Size **********
217be168c0dSopenharmony_ci+PrimitivePtr MindIR_Size_CreatePrimitive();
218be168c0dSopenharmony_ci+
219be168c0dSopenharmony_ci+// ********** RandomStandardNormal **********
220be168c0dSopenharmony_ci+PrimitivePtr MindIR_RandomStandardNormal_CreatePrimitive(int64_t seed, int64_t seed2);
221be168c0dSopenharmony_ci+int64_t MindIR_RandomStandardNormal_GetSeed(ConstPrimitivePtr primitive);
222be168c0dSopenharmony_ci+void MindIR_RandomStandardNormal_SetSeed(PrimitivePtr *primitive, int64_t seed);
223be168c0dSopenharmony_ci+int64_t MindIR_RandomStandardNormal_GetSeed2(ConstPrimitivePtr primitive);
224be168c0dSopenharmony_ci+void MindIR_RandomStandardNormal_SetSeed2(PrimitivePtr *primitive, int64_t seed2);
225be168c0dSopenharmony_ci+
226be168c0dSopenharmony_ci+// ********** CropAndResize **********
227be168c0dSopenharmony_ci+PrimitivePtr MindIR_CropAndResize_CreatePrimitive(ResizeMethod method, float extrapolation_value);
228be168c0dSopenharmony_ci+ResizeMethod MindIR_CropAndResize_GetMethod(ConstPrimitivePtr primitive);
229be168c0dSopenharmony_ci+void MindIR_CropAndResize_SetMethod(PrimitivePtr *primitive, ResizeMethod method);
230be168c0dSopenharmony_ci+float MindIR_CropAndResize_GetExtrapolationValue(ConstPrimitivePtr primitive);
231be168c0dSopenharmony_ci+void MindIR_CropAndResize_SetExtrapolationValue(PrimitivePtr *primitive, float extrapolation_value);
232be168c0dSopenharmony_ci+
233be168c0dSopenharmony_ci+// ********** IsFinite **********
234be168c0dSopenharmony_ci+PrimitivePtr MindIR_IsFinite_CreatePrimitive();
235be168c0dSopenharmony_ci+
236be168c0dSopenharmony_ci+// ********** LinSpace **********
237be168c0dSopenharmony_ci+PrimitivePtr MindIR_LinSpace_CreatePrimitive();
238be168c0dSopenharmony_ci+
239be168c0dSopenharmony_ci+// ********** UniformReal **********
240be168c0dSopenharmony_ci+PrimitivePtr MindIR_UniformReal_CreatePrimitive(int64_t seed, int64_t seed2);
241be168c0dSopenharmony_ci+int64_t MindIR_UniformReal_GetSeed(ConstPrimitivePtr primitive);
242be168c0dSopenharmony_ci+void MindIR_UniformReal_SetSeed(PrimitivePtr *primitive, int64_t seed);
243be168c0dSopenharmony_ci+int64_t MindIR_UniformReal_GetSeed2(ConstPrimitivePtr primitive);
244be168c0dSopenharmony_ci+void MindIR_UniformReal_SetSeed2(PrimitivePtr *primitive, int64_t seed2);
245be168c0dSopenharmony_ci+
246be168c0dSopenharmony_ci+// ********** Splice **********
247be168c0dSopenharmony_ci+PrimitivePtr MindIR_Splice_CreatePrimitive(const std::vector<int64_t>& context, const std::vector<int64_t>& forward_indexes, int64_t output_dim);
248be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_Splice_GetContext(ConstPrimitivePtr primitive);
249be168c0dSopenharmony_ci+void MindIR_Splice_SetContext(PrimitivePtr *primitive, const std::vector<int64_t>& context);
250be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_Splice_GetForwardIndexes(ConstPrimitivePtr primitive);
251be168c0dSopenharmony_ci+void MindIR_Splice_SetForwardIndexes(PrimitivePtr *primitive, const std::vector<int64_t>& forward_indexes);
252be168c0dSopenharmony_ci+int64_t MindIR_Splice_GetOutputDim(ConstPrimitivePtr primitive);
253be168c0dSopenharmony_ci+void MindIR_Splice_SetOutputDim(PrimitivePtr *primitive, int64_t output_dim);
254be168c0dSopenharmony_ci+
255be168c0dSopenharmony_ci+// ********** Call **********
256be168c0dSopenharmony_ci+PrimitivePtr MindIR_Call_CreatePrimitive(bool is_tail_call);
257be168c0dSopenharmony_ci+bool MindIR_Call_GetIsTailCall(ConstPrimitivePtr primitive);
258be168c0dSopenharmony_ci+void MindIR_Call_SetIsTailCall(PrimitivePtr *primitive, bool is_tail_call);
259be168c0dSopenharmony_ci+
260be168c0dSopenharmony_ci+// ********** CumSum **********
261be168c0dSopenharmony_ci+PrimitivePtr MindIR_CumSum_CreatePrimitive(bool exclusive, bool reverse);
262be168c0dSopenharmony_ci+bool MindIR_CumSum_GetExclusive(ConstPrimitivePtr primitive);
263be168c0dSopenharmony_ci+void MindIR_CumSum_SetExclusive(PrimitivePtr *primitive, bool exclusive);
264be168c0dSopenharmony_ci+bool MindIR_CumSum_GetReverse(ConstPrimitivePtr primitive);
265be168c0dSopenharmony_ci+void MindIR_CumSum_SetReverse(PrimitivePtr *primitive, bool reverse);
266be168c0dSopenharmony_ci+
267be168c0dSopenharmony_ci+// ********** SplitWithOverlap **********
268be168c0dSopenharmony_ci+PrimitivePtr MindIR_SplitWithOverlap_CreatePrimitive(int64_t split_dim, int64_t number_split, const std::vector<int64_t>& ratio, const std::vector<int64_t>& extend_top, const std::vector<int64_t>& extend_bottom);
269be168c0dSopenharmony_ci+int64_t MindIR_SplitWithOverlap_GetSplitDim(ConstPrimitivePtr primitive);
270be168c0dSopenharmony_ci+void MindIR_SplitWithOverlap_SetSplitDim(PrimitivePtr *primitive, int64_t split_dim);
271be168c0dSopenharmony_ci+int64_t MindIR_SplitWithOverlap_GetNumberSplit(ConstPrimitivePtr primitive);
272be168c0dSopenharmony_ci+void MindIR_SplitWithOverlap_SetNumberSplit(PrimitivePtr *primitive, int64_t number_split);
273be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_SplitWithOverlap_GetRatio(ConstPrimitivePtr primitive);
274be168c0dSopenharmony_ci+void MindIR_SplitWithOverlap_SetRatio(PrimitivePtr *primitive, const std::vector<int64_t>& ratio);
275be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_SplitWithOverlap_GetExtendTop(ConstPrimitivePtr primitive);
276be168c0dSopenharmony_ci+void MindIR_SplitWithOverlap_SetExtendTop(PrimitivePtr *primitive, const std::vector<int64_t>& extend_top);
277be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_SplitWithOverlap_GetExtendBottom(ConstPrimitivePtr primitive);
278be168c0dSopenharmony_ci+void MindIR_SplitWithOverlap_SetExtendBottom(PrimitivePtr *primitive, const std::vector<int64_t>& extend_bottom);
279be168c0dSopenharmony_ci+
280be168c0dSopenharmony_ci+// ********** GenOP **********
281be168c0dSopenharmony_ci+PrimitivePtr MindIR_GenOP_CreatePrimitive(ActivationType activation_type, float alpha, float min_val, float max_val, bool is_training, Format format, const std::vector<int64_t>& kernel_size, const std::vector<int64_t>& stride, const std::vector<int64_t>& dilation, PadMode pad_mode, const std::vector<int64_t>& pad_list, int64_t mode, int64_t group, int64_t in_channel, int64_t out_channel, EltwiseMode eltwise_mode, bool has_bias, bool use_axis, int64_t axis, float epsilon, float momentum, bool transpose_a, bool transpose_b, const std::vector<int64_t>& pad, RoundMode round_mode, bool global, bool channel_shared, const std::vector<int64_t>& axes, bool keep_dims, ReduceMode reduce_mode, bool reduce_to_end, float coeff);
282be168c0dSopenharmony_ci+ActivationType MindIR_GenOP_GetActivationType(ConstPrimitivePtr primitive);
283be168c0dSopenharmony_ci+void MindIR_GenOP_SetActivationType(PrimitivePtr *primitive, ActivationType activation_type);
284be168c0dSopenharmony_ci+float MindIR_GenOP_GetAlpha(ConstPrimitivePtr primitive);
285be168c0dSopenharmony_ci+void MindIR_GenOP_SetAlpha(PrimitivePtr *primitive, float alpha);
286be168c0dSopenharmony_ci+float MindIR_GenOP_GetMinVal(ConstPrimitivePtr primitive);
287be168c0dSopenharmony_ci+void MindIR_GenOP_SetMinVal(PrimitivePtr *primitive, float min_val);
288be168c0dSopenharmony_ci+float MindIR_GenOP_GetMaxVal(ConstPrimitivePtr primitive);
289be168c0dSopenharmony_ci+void MindIR_GenOP_SetMaxVal(PrimitivePtr *primitive, float max_val);
290be168c0dSopenharmony_ci+bool MindIR_GenOP_GetIsTraining(ConstPrimitivePtr primitive);
291be168c0dSopenharmony_ci+void MindIR_GenOP_SetIsTraining(PrimitivePtr *primitive, bool is_training);
292be168c0dSopenharmony_ci+Format MindIR_GenOP_GetFormat(ConstPrimitivePtr primitive);
293be168c0dSopenharmony_ci+void MindIR_GenOP_SetFormat(PrimitivePtr *primitive, Format format);
294be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_GenOP_GetKernelSize(ConstPrimitivePtr primitive);
295be168c0dSopenharmony_ci+void MindIR_GenOP_SetKernelSize(PrimitivePtr *primitive, const std::vector<int64_t>& kernel_size);
296be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_GenOP_GetStride(ConstPrimitivePtr primitive);
297be168c0dSopenharmony_ci+void MindIR_GenOP_SetStride(PrimitivePtr *primitive, const std::vector<int64_t>& stride);
298be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_GenOP_GetDilation(ConstPrimitivePtr primitive);
299be168c0dSopenharmony_ci+void MindIR_GenOP_SetDilation(PrimitivePtr *primitive, const std::vector<int64_t>& dilation);
300be168c0dSopenharmony_ci+PadMode MindIR_GenOP_GetPadMode(ConstPrimitivePtr primitive);
301be168c0dSopenharmony_ci+void MindIR_GenOP_SetPadMode(PrimitivePtr *primitive, PadMode pad_mode);
302be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_GenOP_GetPadList(ConstPrimitivePtr primitive);
303be168c0dSopenharmony_ci+void MindIR_GenOP_SetPadList(PrimitivePtr *primitive, const std::vector<int64_t>& pad_list);
304be168c0dSopenharmony_ci+int64_t MindIR_GenOP_GetMode(ConstPrimitivePtr primitive);
305be168c0dSopenharmony_ci+void MindIR_GenOP_SetMode(PrimitivePtr *primitive, int64_t mode);
306be168c0dSopenharmony_ci+int64_t MindIR_GenOP_GetGroup(ConstPrimitivePtr primitive);
307be168c0dSopenharmony_ci+void MindIR_GenOP_SetGroup(PrimitivePtr *primitive, int64_t group);
308be168c0dSopenharmony_ci+int64_t MindIR_GenOP_GetInChannel(ConstPrimitivePtr primitive);
309be168c0dSopenharmony_ci+void MindIR_GenOP_SetInChannel(PrimitivePtr *primitive, int64_t in_channel);
310be168c0dSopenharmony_ci+int64_t MindIR_GenOP_GetOutChannel(ConstPrimitivePtr primitive);
311be168c0dSopenharmony_ci+void MindIR_GenOP_SetOutChannel(PrimitivePtr *primitive, int64_t out_channel);
312be168c0dSopenharmony_ci+EltwiseMode MindIR_GenOP_GetEltwiseMode(ConstPrimitivePtr primitive);
313be168c0dSopenharmony_ci+void MindIR_GenOP_SetEltwiseMode(PrimitivePtr *primitive, EltwiseMode eltwise_mode);
314be168c0dSopenharmony_ci+bool MindIR_GenOP_GetHasBias(ConstPrimitivePtr primitive);
315be168c0dSopenharmony_ci+void MindIR_GenOP_SetHasBias(PrimitivePtr *primitive, bool has_bias);
316be168c0dSopenharmony_ci+bool MindIR_GenOP_GetUseAxis(ConstPrimitivePtr primitive);
317be168c0dSopenharmony_ci+void MindIR_GenOP_SetUseAxis(PrimitivePtr *primitive, bool use_axis);
318be168c0dSopenharmony_ci+int64_t MindIR_GenOP_GetAxis(ConstPrimitivePtr primitive);
319be168c0dSopenharmony_ci+void MindIR_GenOP_SetAxis(PrimitivePtr *primitive, int64_t axis);
320be168c0dSopenharmony_ci+float MindIR_GenOP_GetEpsilon(ConstPrimitivePtr primitive);
321be168c0dSopenharmony_ci+void MindIR_GenOP_SetEpsilon(PrimitivePtr *primitive, float epsilon);
322be168c0dSopenharmony_ci+float MindIR_GenOP_GetMomentum(ConstPrimitivePtr primitive);
323be168c0dSopenharmony_ci+void MindIR_GenOP_SetMomentum(PrimitivePtr *primitive, float momentum);
324be168c0dSopenharmony_ci+bool MindIR_GenOP_GetTransposeA(ConstPrimitivePtr primitive);
325be168c0dSopenharmony_ci+void MindIR_GenOP_SetTransposeA(PrimitivePtr *primitive, bool transpose_a);
326be168c0dSopenharmony_ci+bool MindIR_GenOP_GetTransposeB(ConstPrimitivePtr primitive);
327be168c0dSopenharmony_ci+void MindIR_GenOP_SetTransposeB(PrimitivePtr *primitive, bool transpose_b);
328be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_GenOP_GetPad(ConstPrimitivePtr primitive);
329be168c0dSopenharmony_ci+void MindIR_GenOP_SetPad(PrimitivePtr *primitive, const std::vector<int64_t>& pad);
330be168c0dSopenharmony_ci+RoundMode MindIR_GenOP_GetRoundMode(ConstPrimitivePtr primitive);
331be168c0dSopenharmony_ci+void MindIR_GenOP_SetRoundMode(PrimitivePtr *primitive, RoundMode round_mode);
332be168c0dSopenharmony_ci+bool MindIR_GenOP_GetGlobal(ConstPrimitivePtr primitive);
333be168c0dSopenharmony_ci+void MindIR_GenOP_SetGlobal(PrimitivePtr *primitive, bool global);
334be168c0dSopenharmony_ci+bool MindIR_GenOP_GetChannelShared(ConstPrimitivePtr primitive);
335be168c0dSopenharmony_ci+void MindIR_GenOP_SetChannelShared(PrimitivePtr *primitive, bool channel_shared);
336be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_GenOP_GetAxes(ConstPrimitivePtr primitive);
337be168c0dSopenharmony_ci+void MindIR_GenOP_SetAxes(PrimitivePtr *primitive, const std::vector<int64_t>& axes);
338be168c0dSopenharmony_ci+bool MindIR_GenOP_GetKeepDims(ConstPrimitivePtr primitive);
339be168c0dSopenharmony_ci+void MindIR_GenOP_SetKeepDims(PrimitivePtr *primitive, bool keep_dims);
340be168c0dSopenharmony_ci+ReduceMode MindIR_GenOP_GetReduceMode(ConstPrimitivePtr primitive);
341be168c0dSopenharmony_ci+void MindIR_GenOP_SetReduceMode(PrimitivePtr *primitive, ReduceMode reduce_mode);
342be168c0dSopenharmony_ci+bool MindIR_GenOP_GetReduceToEnd(ConstPrimitivePtr primitive);
343be168c0dSopenharmony_ci+void MindIR_GenOP_SetReduceToEnd(PrimitivePtr *primitive, bool reduce_to_end);
344be168c0dSopenharmony_ci+float MindIR_GenOP_GetCoeff(ConstPrimitivePtr primitive);
345be168c0dSopenharmony_ci+void MindIR_GenOP_SetCoeff(PrimitivePtr *primitive, float coeff);
346be168c0dSopenharmony_ci+
347be168c0dSopenharmony_ci+// ********** RaggedRange **********
348be168c0dSopenharmony_ci+PrimitivePtr MindIR_RaggedRange_CreatePrimitive();
349be168c0dSopenharmony_ci+
350be168c0dSopenharmony_ci+// ********** GLU **********
351be168c0dSopenharmony_ci+PrimitivePtr MindIR_GLU_CreatePrimitive(int64_t axis);
352be168c0dSopenharmony_ci+int64_t MindIR_GLU_GetAxis(ConstPrimitivePtr primitive);
353be168c0dSopenharmony_ci+void MindIR_GLU_SetAxis(PrimitivePtr *primitive, int64_t axis);
354be168c0dSopenharmony_ci+
355be168c0dSopenharmony_ci+// ********** Affine **********
356be168c0dSopenharmony_ci+PrimitivePtr MindIR_Affine_CreatePrimitive(const std::vector<int64_t>& context, int64_t output_dim, ActivationType activation_type, bool transpose_a, bool transpose_b);
357be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_Affine_GetContext(ConstPrimitivePtr primitive);
358be168c0dSopenharmony_ci+void MindIR_Affine_SetContext(PrimitivePtr *primitive, const std::vector<int64_t>& context);
359be168c0dSopenharmony_ci+int64_t MindIR_Affine_GetOutputDim(ConstPrimitivePtr primitive);
360be168c0dSopenharmony_ci+void MindIR_Affine_SetOutputDim(PrimitivePtr *primitive, int64_t output_dim);
361be168c0dSopenharmony_ci+ActivationType MindIR_Affine_GetActivationType(ConstPrimitivePtr primitive);
362be168c0dSopenharmony_ci+void MindIR_Affine_SetActivationType(PrimitivePtr *primitive, ActivationType activation_type);
363be168c0dSopenharmony_ci+bool MindIR_Affine_GetTransposeA(ConstPrimitivePtr primitive);
364be168c0dSopenharmony_ci+void MindIR_Affine_SetTransposeA(PrimitivePtr *primitive, bool transpose_a);
365be168c0dSopenharmony_ci+bool MindIR_Affine_GetTransposeB(ConstPrimitivePtr primitive);
366be168c0dSopenharmony_ci+void MindIR_Affine_SetTransposeB(PrimitivePtr *primitive, bool transpose_b);
367be168c0dSopenharmony_ci+
368be168c0dSopenharmony_ci+// ********** AllGather **********
369be168c0dSopenharmony_ci+PrimitivePtr MindIR_AllGather_CreatePrimitive(const std::string& group, int32_t rank_size);
370be168c0dSopenharmony_ci+std::string MindIR_AllGather_GetGroup(ConstPrimitivePtr primitive);
371be168c0dSopenharmony_ci+void MindIR_AllGather_SetGroup(PrimitivePtr *primitive, const std::string& group);
372be168c0dSopenharmony_ci+int32_t MindIR_AllGather_GetRankSize(ConstPrimitivePtr primitive);
373be168c0dSopenharmony_ci+void MindIR_AllGather_SetRankSize(PrimitivePtr *primitive, int32_t rank_size);
374be168c0dSopenharmony_ci+
375be168c0dSopenharmony_ci+
376be168c0dSopenharmony_ci+
377be168c0dSopenharmony_ci+// ********** ReduceScatter **********
378be168c0dSopenharmony_ci+PrimitivePtr MindIR_ReduceScatter_CreatePrimitive(const std::string& group, ReduceMode mode, int32_t rank_size);
379be168c0dSopenharmony_ci+std::string MindIR_ReduceScatter_GetGroup(ConstPrimitivePtr primitive);
380be168c0dSopenharmony_ci+void MindIR_ReduceScatter_SetGroup(PrimitivePtr *primitive, const std::string& group);
381be168c0dSopenharmony_ci+ReduceMode MindIR_ReduceScatter_GetMode(ConstPrimitivePtr primitive);
382be168c0dSopenharmony_ci+void MindIR_ReduceScatter_SetMode(PrimitivePtr *primitive, ReduceMode mode);
383be168c0dSopenharmony_ci+int32_t MindIR_ReduceScatter_GetRankSize(ConstPrimitivePtr primitive);
384be168c0dSopenharmony_ci+void MindIR_ReduceScatter_SetRankSize(PrimitivePtr *primitive, int32_t rank_size);
385be168c0dSopenharmony_ci+
386be168c0dSopenharmony_ci+
387be168c0dSopenharmony_ci+
388be168c0dSopenharmony_ci+// ********** DynamicQuant **********
389be168c0dSopenharmony_ci+PrimitivePtr MindIR_DynamicQuant_CreatePrimitive(bool symmetric, int64_t dst_type);
390be168c0dSopenharmony_ci+bool MindIR_DynamicQuant_GetSymmetric(ConstPrimitivePtr primitive);
391be168c0dSopenharmony_ci+void MindIR_DynamicQuant_SetSymmetric(PrimitivePtr *primitive, bool symmetric);
392be168c0dSopenharmony_ci+int64_t MindIR_DynamicQuant_GetDstType(ConstPrimitivePtr primitive);
393be168c0dSopenharmony_ci+void MindIR_DynamicQuant_SetDstType(PrimitivePtr *primitive, int64_t dst_type);
394be168c0dSopenharmony_ci+
395be168c0dSopenharmony_ci+// ********** RandomNormal **********
396be168c0dSopenharmony_ci+PrimitivePtr MindIR_RandomNormal_CreatePrimitive(float seed, float mean, float scale);
397be168c0dSopenharmony_ci+float MindIR_RandomNormal_GetSeed(ConstPrimitivePtr primitive);
398be168c0dSopenharmony_ci+void MindIR_RandomNormal_SetSeed(PrimitivePtr *primitive, float seed);
399be168c0dSopenharmony_ci+float MindIR_RandomNormal_GetMean(ConstPrimitivePtr primitive);
400be168c0dSopenharmony_ci+void MindIR_RandomNormal_SetMean(PrimitivePtr *primitive, float mean);
401be168c0dSopenharmony_ci+float MindIR_RandomNormal_GetScale(ConstPrimitivePtr primitive);
402be168c0dSopenharmony_ci+void MindIR_RandomNormal_SetScale(PrimitivePtr *primitive, float scale);
403be168c0dSopenharmony_ci+
404be168c0dSopenharmony_ci+// ********** FormatTranspose **********
405be168c0dSopenharmony_ci+PrimitivePtr MindIR_FormatTranspose_CreatePrimitive(Format src_format, Format dst_format);
406be168c0dSopenharmony_ci+Format MindIR_FormatTranspose_GetSrcFormat(ConstPrimitivePtr primitive);
407be168c0dSopenharmony_ci+void MindIR_FormatTranspose_SetSrcFormat(PrimitivePtr *primitive, Format src_format);
408be168c0dSopenharmony_ci+Format MindIR_FormatTranspose_GetDstFormat(ConstPrimitivePtr primitive);
409be168c0dSopenharmony_ci+void MindIR_FormatTranspose_SetDstFormat(PrimitivePtr *primitive, Format dst_format);
410be168c0dSopenharmony_ci+
411be168c0dSopenharmony_ci+// ********** GatherD **********
412be168c0dSopenharmony_ci+PrimitivePtr MindIR_GatherD_CreatePrimitive();
413be168c0dSopenharmony_ci+
414be168c0dSopenharmony_ci+// ********** GroupNormFusion **********
415be168c0dSopenharmony_ci+PrimitivePtr MindIR_GroupNormFusion_CreatePrimitive(int64_t num_groups, float epsilon, bool affine);
416be168c0dSopenharmony_ci+int64_t MindIR_GroupNormFusion_GetNumGroups(ConstPrimitivePtr primitive);
417be168c0dSopenharmony_ci+void MindIR_GroupNormFusion_SetNumGroups(PrimitivePtr *primitive, int64_t num_groups);
418be168c0dSopenharmony_ci+float MindIR_GroupNormFusion_GetEpsilon(ConstPrimitivePtr primitive);
419be168c0dSopenharmony_ci+void MindIR_GroupNormFusion_SetEpsilon(PrimitivePtr *primitive, float epsilon);
420be168c0dSopenharmony_ci+bool MindIR_GroupNormFusion_GetAffine(ConstPrimitivePtr primitive);
421be168c0dSopenharmony_ci+void MindIR_GroupNormFusion_SetAffine(PrimitivePtr *primitive, bool affine);
422be168c0dSopenharmony_ci+
423be168c0dSopenharmony_ci+// ********** Log1p **********
424be168c0dSopenharmony_ci+PrimitivePtr MindIR_Log1p_CreatePrimitive();
425be168c0dSopenharmony_ci+
426be168c0dSopenharmony_ci+// ********** SparseFillEmptyRows **********
427be168c0dSopenharmony_ci+PrimitivePtr MindIR_SparseFillEmptyRows_CreatePrimitive();
428be168c0dSopenharmony_ci+
429be168c0dSopenharmony_ci+// ********** SparseReshape **********
430be168c0dSopenharmony_ci+PrimitivePtr MindIR_SparseReshape_CreatePrimitive();
431be168c0dSopenharmony_ci+
432be168c0dSopenharmony_ci+// ********** SparseSegmentSum **********
433be168c0dSopenharmony_ci+PrimitivePtr MindIR_SparseSegmentSum_CreatePrimitive();
434be168c0dSopenharmony_ci+
435be168c0dSopenharmony_ci+// ********** ScatterElements **********
436be168c0dSopenharmony_ci+PrimitivePtr MindIR_ScatterElements_CreatePrimitive(int64_t axis);
437be168c0dSopenharmony_ci+int64_t MindIR_ScatterElements_GetAxis(ConstPrimitivePtr primitive);
438be168c0dSopenharmony_ci+void MindIR_ScatterElements_SetAxis(PrimitivePtr *primitive, int64_t axis);
439be168c0dSopenharmony_ci+
440be168c0dSopenharmony_ci+// ********** Triu **********
441be168c0dSopenharmony_ci+PrimitivePtr MindIR_Triu_CreatePrimitive();
442be168c0dSopenharmony_ci+
443be168c0dSopenharmony_ci+// ********** Tril **********
444be168c0dSopenharmony_ci+PrimitivePtr MindIR_Tril_CreatePrimitive();
445be168c0dSopenharmony_ci+
446be168c0dSopenharmony_ci // ********** Custom **********
447be168c0dSopenharmony_ci std::vector<const mindspore::schema::Attribute *> MindIR_Custom_GetAttr(ConstPrimitivePtr primitive);
448be168c0dSopenharmony_ci std::string MindIR_Attribute_GetName(const mindspore::schema::Attribute &attr);
449be168c0dSopenharmony_cidiff --git a/mindspore/lite/mindir/include/mindir_tensor.h b/mindspore/lite/mindir/include/mindir_tensor.h
450be168c0dSopenharmony_ciindex 43c1478c..d8b4aa37 100644
451be168c0dSopenharmony_ci--- a/mindspore/lite/mindir/include/mindir_tensor.h
452be168c0dSopenharmony_ci+++ b/mindspore/lite/mindir/include/mindir_tensor.h
453be168c0dSopenharmony_ci@@ -23,6 +23,7 @@ void MindIR_Tensor_SetData(TensorPtr *tensor, const std::vector<uint8_t> &data);
454be168c0dSopenharmony_ci std::vector<uint8_t> MindIR_Tensor_GetData(ConstTensorPtr tensor);
455be168c0dSopenharmony_ci std::vector<QuantParam> MindIR_Tensor_GetQuantParams(ConstTensorPtr tensor);
456be168c0dSopenharmony_ci void MindIR_Tensor_SetQuantParams(TensorPtr *tensor, const std::vector<QuantParam> &quant_params);
457be168c0dSopenharmony_ci+int32_t MindIR_Tensor_GetNodeType(ConstTensorPtr tensor);
458be168c0dSopenharmony_ci 
459be168c0dSopenharmony_ci void MindIR_Tensor_Destroy(TensorPtr *tensor);
460be168c0dSopenharmony_ci 
461be168c0dSopenharmony_cidiff --git a/mindspore/lite/mindir/include/mindir_types.h b/mindspore/lite/mindir/include/mindir_types.h
462be168c0dSopenharmony_ciindex 196995fa..ec224b2c 100644
463be168c0dSopenharmony_ci--- a/mindspore/lite/mindir/include/mindir_types.h
464be168c0dSopenharmony_ci+++ b/mindspore/lite/mindir/include/mindir_types.h
465be168c0dSopenharmony_ci@@ -84,6 +84,7 @@ enum NodeType : uint32_t {
466be168c0dSopenharmony_ci   NODE_TYPE_ARGMAX_FUSION = 11,
467be168c0dSopenharmony_ci   NODE_TYPE_ASSERT = 13,
468be168c0dSopenharmony_ci   NODE_TYPE_AVG_POOL_FUSION = 17,
469be168c0dSopenharmony_ci+  NODE_TYPE_BATCH_TO_SPACE = 21,
470be168c0dSopenharmony_ci   NODE_TYPE_BATCH_TO_SPACE_ND = 22,
471be168c0dSopenharmony_ci   NODE_TYPE_BIAS_ADD = 23,
472be168c0dSopenharmony_ci   NODE_TYPE_BROADCAST_TO = 27,
473be168c0dSopenharmony_ci@@ -96,15 +97,25 @@ enum NodeType : uint32_t {
474be168c0dSopenharmony_ci   NODE_TYPE_COS = 37,
475be168c0dSopenharmony_ci   NODE_TYPE_CONSTANT_OF_SHAPE = 38,
476be168c0dSopenharmony_ci   NODE_TYPE_CROP = 39,
477be168c0dSopenharmony_ci+  NODE_TYPE_DEPEND = 44,
478be168c0dSopenharmony_ci   NODE_TYPE_DEPTH_TO_SPACE = 45,
479be168c0dSopenharmony_ci   NODE_TYPE_DETECTION_POST_PROCESS = 46,
480be168c0dSopenharmony_ci   NODE_TYPE_DIV_FUSION = 47,
481be168c0dSopenharmony_ci+  NODE_TYPE_DROPOUT = 49,
482be168c0dSopenharmony_ci+  NODE_TYPE_ELU = 51,
483be168c0dSopenharmony_ci   NODE_TYPE_ELTWISE = 52,
484be168c0dSopenharmony_ci   NODE_TYPE_EQUAL = 53,
485be168c0dSopenharmony_ci+  NODE_TYPE_EMBEDDING_LOOKUP_FUSION = 54,
486be168c0dSopenharmony_ci   NODE_TYPE_EXPFUSION = 55,
487be168c0dSopenharmony_ci   NODE_TYPE_EXPAND_DIMS = 56,
488be168c0dSopenharmony_ci+  NODE_TYPE_FAKE_QUANT_WITH_MIN_MAX_VARS = 57,
489be168c0dSopenharmony_ci+  NODE_TYPE_FAKE_QUANT_WITH_MIN_MAX_VARS_PER_CHANNEL = 58,
490be168c0dSopenharmony_ci+  NODE_TYPE_FFT_REAL = 59,
491be168c0dSopenharmony_ci+  NODE_TYPE_FFT_IMAG = 60,
492be168c0dSopenharmony_ci   NODE_TYPE_FLATTEN = 61,
493be168c0dSopenharmony_ci   NODE_TYPE_FLOOR = 63,
494be168c0dSopenharmony_ci+  NODE_TYPE_FLOOR_DIV = 64,
495be168c0dSopenharmony_ci+  NODE_TYPE_FLOOR_MOD = 65,
496be168c0dSopenharmony_ci   NODE_TYPE_FILL = 66,
497be168c0dSopenharmony_ci   NODE_TYPE_FULL_CONNECTION = 67,
498be168c0dSopenharmony_ci   NODE_TYPE_FUSED_BATCH_NORM = 68,
499be168c0dSopenharmony_ci@@ -112,6 +123,7 @@ enum NodeType : uint32_t {
500be168c0dSopenharmony_ci   NODE_TYPE_GATHER_ND = 70,
501be168c0dSopenharmony_ci   NODE_TYPE_GREATER = 71,
502be168c0dSopenharmony_ci   NODE_TYPE_GREATER_EQUAL = 72,
503be168c0dSopenharmony_ci+  NODE_TYPE_HASHTABLE_LOOKUP = 73,
504be168c0dSopenharmony_ci   NODE_TYPE_INSTANCE_NORM = 74,
505be168c0dSopenharmony_ci   NODE_TYPE_LAYER_NORM_FUSION = 75,
506be168c0dSopenharmony_ci   NODE_TYPE_LEAKY_RELU = 76,
507be168c0dSopenharmony_ci@@ -121,20 +133,28 @@ enum NodeType : uint32_t {
508be168c0dSopenharmony_ci   NODE_TYPE_LOGICAL_AND = 81,
509be168c0dSopenharmony_ci   NODE_TYPE_LOGICAL_NOT = 82,
510be168c0dSopenharmony_ci   NODE_TYPE_LOGICAL_OR = 83,
511be168c0dSopenharmony_ci+  NODE_TYPE_LP_NORMALIZATION = 84,
512be168c0dSopenharmony_ci   NODE_TYPE_L_R_N = 85,
513be168c0dSopenharmony_ci+  NODE_TYPE_LSH_PROJECTION = 86,
514be168c0dSopenharmony_ci   NODE_TYPE_LSTM = 87,
515be168c0dSopenharmony_ci   NODE_TYPE_L2_NORMALIZE_FUSION = 88,
516be168c0dSopenharmony_ci   NODE_TYPE_MATMUL_FUSION = 89,
517be168c0dSopenharmony_ci   NODE_TYPE_MAXIMUM = 90,
518be168c0dSopenharmony_ci   NODE_TYPE_MAX_POOL_FUSION = 92,
519be168c0dSopenharmony_ci+  NODE_TYPE_SWITCH_LAYER = 94,
520be168c0dSopenharmony_ci+  NODE_TYPE_MFCC = 95,
521be168c0dSopenharmony_ci   NODE_TYPE_MINIMUM = 96,
522be168c0dSopenharmony_ci   NODE_TYPE_MOD = 98,
523be168c0dSopenharmony_ci   NODE_TYPE_MUL_FUSION = 99,
524be168c0dSopenharmony_ci   NODE_TYPE_NEG = 101,
525be168c0dSopenharmony_ci   NODE_TYPE_NOT_EQUAL = 103,
526be168c0dSopenharmony_ci+  NODE_TYPE_NON_MAX_SUPPRESSION = 104,
527be168c0dSopenharmony_ci   NODE_TYPE_ONE_HOT = 105,
528be168c0dSopenharmony_ci+  NODE_TYPE_ONES_LIKE = 106,
529be168c0dSopenharmony_ci   NODE_TYPE_PAD_FUSION = 107,
530be168c0dSopenharmony_ci+  NODE_TYPE_PARTIAL_FUSION = 108,
531be168c0dSopenharmony_ci   NODE_TYPE_POW_FUSION = 110,
532be168c0dSopenharmony_ci+  NODE_TYPE_PRIOR_BOX = 111,
533be168c0dSopenharmony_ci   NODE_TYPE_PRELU_FUSION = 112,
534be168c0dSopenharmony_ci   NODE_TYPE_QUANT_DTYPE_CAST = 113,
535be168c0dSopenharmony_ci   NODE_TYPE_RANK = 114,
536be168c0dSopenharmony_ci@@ -144,12 +164,17 @@ enum NodeType : uint32_t {
537be168c0dSopenharmony_ci   NODE_TYPE_REDUCE_FUSION = 118,
538be168c0dSopenharmony_ci   NODE_TYPE_RESHAPE = 119,
539be168c0dSopenharmony_ci   NODE_TYPE_RESIZE = 120,
540be168c0dSopenharmony_ci+  NODE_TYPE_REVERSE_SEQUENCE = 121,
541be168c0dSopenharmony_ci+  NODE_TYPE_REVERSE_V2 = 122,
542be168c0dSopenharmony_ci+  NODE_TYPE_RFFT = 123,
543be168c0dSopenharmony_ci+  NODE_TYPE_R_O_I_POOLING = 124,
544be168c0dSopenharmony_ci   NODE_TYPE_ROUND = 125,
545be168c0dSopenharmony_ci   NODE_TYPE_RSQRT = 126,
546be168c0dSopenharmony_ci   NODE_TYPE_SCALE_FUSION = 127,
547be168c0dSopenharmony_ci   NODE_TYPE_SCATTER_ND = 128,
548be168c0dSopenharmony_ci   NODE_TYPE_SHAPE = 130,
549be168c0dSopenharmony_ci   NODE_TYPE_SIN = 133,
550be168c0dSopenharmony_ci+  NODE_TYPE_SKIP_GRAM = 134,
551be168c0dSopenharmony_ci   NODE_TYPE_SLICE_FUSION = 135,
552be168c0dSopenharmony_ci   NODE_TYPE_SOFTMAX = 138,
553be168c0dSopenharmony_ci   NODE_TYPE_SPACE_TO_BATCH_ND = 141,
554be168c0dSopenharmony_ci@@ -163,16 +188,51 @@ enum NodeType : uint32_t {
555be168c0dSopenharmony_ci   NODE_TYPE_STACK = 150,
556be168c0dSopenharmony_ci   NODE_TYPE_STRIDED_SLICE = 151,
557be168c0dSopenharmony_ci   NODE_TYPE_SUB_FUSION = 152,
558be168c0dSopenharmony_ci+  NODE_TYPE_SWITCH = 154,
559be168c0dSopenharmony_ci   NODE_TYPE_TILE_FUSION = 160,
560be168c0dSopenharmony_ci   NODE_TYPE_TOPK_FUSION = 161,
561be168c0dSopenharmony_ci   NODE_TYPE_TRANSPOSE = 162,
562be168c0dSopenharmony_ci+  NODE_TYPE_UNIQUE = 163,
563be168c0dSopenharmony_ci+  NODE_TYPE_UNSORTED_SEGMENT_SUM = 164,
564be168c0dSopenharmony_ci   NODE_TYPE_UNSQUEEZE = 165,
565be168c0dSopenharmony_ci   NODE_TYPE_UNSTACK = 166,
566be168c0dSopenharmony_ci   NODE_TYPE_WHERE = 168,
567be168c0dSopenharmony_ci+  NODE_TYPE_ZEROS_LIKE = 169,
568be168c0dSopenharmony_ci   NODE_TYPE_SELECT = 170,
569be168c0dSopenharmony_ci+  NODE_TYPE_G_R_U = 172,
570be168c0dSopenharmony_ci+  NODE_TYPE_NON_ZERO = 173,
571be168c0dSopenharmony_ci+  NODE_TYPE_INVERT_PERMUTATION = 174,
572be168c0dSopenharmony_ci+  NODE_TYPE_SIZE = 175,
573be168c0dSopenharmony_ci+  NODE_TYPE_RANDOM_STANDARD_NORMAL = 176,
574be168c0dSopenharmony_ci+  NODE_TYPE_CROP_AND_RESIZE = 177,
575be168c0dSopenharmony_ci   NODE_TYPE_ERF = 178,
576be168c0dSopenharmony_ci+  NODE_TYPE_IS_FINITE = 180,
577be168c0dSopenharmony_ci+  NODE_TYPE_LIN_SPACE = 181,
578be168c0dSopenharmony_ci+  NODE_TYPE_UNIFORM_REAL = 182,
579be168c0dSopenharmony_ci+  NODE_TYPE_SPLICE = 188,
580be168c0dSopenharmony_ci   NODE_TYPE_LOG_SOFTMAX = 189,
581be168c0dSopenharmony_ci+  NODE_TYPE_CALL = 190,
582be168c0dSopenharmony_ci   NODE_TYPE_CUSTOM = 191,
583be168c0dSopenharmony_ci+  NODE_TYPE_CUM_SUM = 192,
584be168c0dSopenharmony_ci+  NODE_TYPE_SPLIT_WITH_OVERLAP = 193,
585be168c0dSopenharmony_ci+  NODE_TYPE_GEN_O_P = 194,
586be168c0dSopenharmony_ci+  NODE_TYPE_RAGGED_RANGE = 195,
587be168c0dSopenharmony_ci+  NODE_TYPE_G_L_U = 196,
588be168c0dSopenharmony_ci+  NODE_TYPE_AFFINE = 200,
589be168c0dSopenharmony_ci+  NODE_TYPE_ALL_GATHER = 201,
590be168c0dSopenharmony_ci+  NODE_TYPE_REDUCE_SCATTER = 202,
591be168c0dSopenharmony_ci+  NODE_TYPE_DYNAMIC_QUANT = 203,
592be168c0dSopenharmony_ci+  NODE_TYPE_RANDOM_NORMAL = 206,
593be168c0dSopenharmony_ci+  NODE_TYPE_FORMAT_TRANSPOSE = 209,
594be168c0dSopenharmony_ci+  NODE_TYPE_GATHER_D = 210,
595be168c0dSopenharmony_ci+  NODE_TYPE_GROUP_NORM_FUSION = 211,
596be168c0dSopenharmony_ci+  NODE_TYPE_LOG1P = 212,
597be168c0dSopenharmony_ci+  NODE_TYPE_SPARSE_FILL_EMPTY_ROWS = 214,
598be168c0dSopenharmony_ci+  NODE_TYPE_SPARSE_RESHAPE = 215,
599be168c0dSopenharmony_ci+  NODE_TYPE_SPARSE_SEGMENT_SUM = 216,
600be168c0dSopenharmony_ci+  NODE_TYPE_SCATTER_ELEMENTS = 217,
601be168c0dSopenharmony_ci+  NODE_TYPE_TRIU = 218,
602be168c0dSopenharmony_ci+  NODE_TYPE_TRIL = 219,
603be168c0dSopenharmony_ci };
604be168c0dSopenharmony_ci 
605be168c0dSopenharmony_ci enum ResizeMethod : int8_t {
606be168c0dSopenharmony_cidiff --git a/mindspore/lite/mindir/src/mindir.cc b/mindspore/lite/mindir/src/mindir.cc
607be168c0dSopenharmony_ciindex a1f86671..39600e4d 100644
608be168c0dSopenharmony_ci--- a/mindspore/lite/mindir/src/mindir.cc
609be168c0dSopenharmony_ci+++ b/mindspore/lite/mindir/src/mindir.cc
610be168c0dSopenharmony_ci@@ -4674,10 +4674,10 @@ std::string MindIR_DepthToSpace_GetMode(ConstPrimitivePtr primitive) {
611be168c0dSopenharmony_ci     if (prim != nullptr && value != nullptr) {
612be168c0dSopenharmony_ci       return std::string(value->mode()->c_str(),value->mode()->size());
613be168c0dSopenharmony_ci     } else {
614be168c0dSopenharmony_ci-      return nullptr;
615be168c0dSopenharmony_ci+      return "";
616be168c0dSopenharmony_ci     }
617be168c0dSopenharmony_ci   } else {
618be168c0dSopenharmony_ci-    return nullptr;
619be168c0dSopenharmony_ci+    return "";
620be168c0dSopenharmony_ci   }
621be168c0dSopenharmony_ci }
622be168c0dSopenharmony_ci 
623be168c0dSopenharmony_ci@@ -6210,10 +6210,10 @@ std::string MindIR_LRN_GetNormRegion(ConstPrimitivePtr primitive) {
624be168c0dSopenharmony_ci     if (prim != nullptr && value != nullptr) {
625be168c0dSopenharmony_ci       return std::string(value->norm_region()->c_str(),value->norm_region()->size());
626be168c0dSopenharmony_ci     } else {
627be168c0dSopenharmony_ci-      return nullptr;
628be168c0dSopenharmony_ci+      return "";
629be168c0dSopenharmony_ci     }
630be168c0dSopenharmony_ci   } else {
631be168c0dSopenharmony_ci-    return nullptr;
632be168c0dSopenharmony_ci+    return "";
633be168c0dSopenharmony_ci   }
634be168c0dSopenharmony_ci }
635be168c0dSopenharmony_ci 
636be168c0dSopenharmony_ci@@ -6750,6 +6750,104 @@ PrimitivePtr MindIR_GatherNd_CreatePrimitive() {
637be168c0dSopenharmony_ci   return ret_value;
638be168c0dSopenharmony_ci }
639be168c0dSopenharmony_ci 
640be168c0dSopenharmony_ci+// ********** BatchToSpace **********
641be168c0dSopenharmony_ci+PrimitivePtr MindIR_BatchToSpace_CreatePrimitive(const std::vector<int64_t> &block_size,
642be168c0dSopenharmony_ci+                                                 const std::vector<std::vector<int64_t>> &crops) {
643be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
644be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateBatchToSpace(fbb, fbb.CreateVector(block_size.data(), block_size.size()),
645be168c0dSopenharmony_ci+                                               CreateVec2D(fbb, crops));
646be168c0dSopenharmony_ci+  auto prim_offset =
647be168c0dSopenharmony_ci+    schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_BATCH_TO_SPACE), ops_offset.o);
648be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
649be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
650be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
651be168c0dSopenharmony_ci+  return ret_value;
652be168c0dSopenharmony_ci+}
653be168c0dSopenharmony_ci+
654be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_BatchToSpace_GetBlockSize(ConstPrimitivePtr primitive) {
655be168c0dSopenharmony_ci+  if (primitive != nullptr) {
656be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
657be168c0dSopenharmony_ci+    auto value = prim->value_as_BatchToSpace();
658be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
659be168c0dSopenharmony_ci+      std::vector<int64_t> result;
660be168c0dSopenharmony_ci+      auto src = value->block_size();
661be168c0dSopenharmony_ci+      if (src == nullptr) {
662be168c0dSopenharmony_ci+        return {};
663be168c0dSopenharmony_ci+      }
664be168c0dSopenharmony_ci+      result.resize(src->size());
665be168c0dSopenharmony_ci+      std::transform(src->begin(), src->end(), result.begin(), [](int64_t item) { return item; });
666be168c0dSopenharmony_ci+      return result;
667be168c0dSopenharmony_ci+    } else {
668be168c0dSopenharmony_ci+      return {};
669be168c0dSopenharmony_ci+    }
670be168c0dSopenharmony_ci+  } else {
671be168c0dSopenharmony_ci+    return {};
672be168c0dSopenharmony_ci+  }
673be168c0dSopenharmony_ci+}
674be168c0dSopenharmony_ci+
675be168c0dSopenharmony_ci+void MindIR_BatchToSpace_SetBlockSize(PrimitivePtr *primitive, const std::vector<int64_t> &block_size) {
676be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
677be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
678be168c0dSopenharmony_ci+    auto value = prim->value_as_BatchToSpace();
679be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
680be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
681be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateBatchToSpace(fbb, fbb.CreateVector(block_size.data(), block_size.size()),
682be168c0dSopenharmony_ci+                                                   CreateVec2D(fbb, value->crops()));
683be168c0dSopenharmony_ci+      auto prim_offset =
684be168c0dSopenharmony_ci+        schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_BATCH_TO_SPACE), ops_offset.o);
685be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
686be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
687be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
688be168c0dSopenharmony_ci+      free(*primitive);
689be168c0dSopenharmony_ci+      *primitive = ret_value;
690be168c0dSopenharmony_ci+    }
691be168c0dSopenharmony_ci+  }
692be168c0dSopenharmony_ci+}
693be168c0dSopenharmony_ci+
694be168c0dSopenharmony_ci+std::vector<std::vector<int64_t>> MindIR_BatchToSpace_GetCrops(ConstPrimitivePtr primitive) {
695be168c0dSopenharmony_ci+  if (primitive != nullptr) {
696be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
697be168c0dSopenharmony_ci+    auto value = prim->value_as_BatchToSpace();
698be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
699be168c0dSopenharmony_ci+      std::vector<std::vector<int64_t>> out;
700be168c0dSopenharmony_ci+      auto src = value->crops();
701be168c0dSopenharmony_ci+      if (src == nullptr) {
702be168c0dSopenharmony_ci+        return {};
703be168c0dSopenharmony_ci+      }
704be168c0dSopenharmony_ci+      for (auto sub_list : *src->data()) {
705be168c0dSopenharmony_ci+        std::vector<int64_t> result_tmp;
706be168c0dSopenharmony_ci+        result_tmp.resize(sub_list->data()->size());
707be168c0dSopenharmony_ci+        std::transform(sub_list->data()->begin(), sub_list->data()->end(), result_tmp.begin(),
708be168c0dSopenharmony_ci+                       [](int64_t item) { return item; });
709be168c0dSopenharmony_ci+        out.emplace_back(result_tmp);
710be168c0dSopenharmony_ci+      }
711be168c0dSopenharmony_ci+      return out;
712be168c0dSopenharmony_ci+    } else {
713be168c0dSopenharmony_ci+      return {};
714be168c0dSopenharmony_ci+    }
715be168c0dSopenharmony_ci+  } else {
716be168c0dSopenharmony_ci+    return {};
717be168c0dSopenharmony_ci+  }
718be168c0dSopenharmony_ci+}
719be168c0dSopenharmony_ci+
720be168c0dSopenharmony_ci+void MindIR_BatchToSpace_SetCrops(PrimitivePtr *primitive, const std::vector<std::vector<int64_t>> &crops) {
721be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
722be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
723be168c0dSopenharmony_ci+    auto value = prim->value_as_BatchToSpace();
724be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
725be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
726be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateBatchToSpace(
727be168c0dSopenharmony_ci+        fbb, fbb.CreateVector(value->block_size()->data(), value->block_size()->size()), CreateVec2D(fbb, crops));
728be168c0dSopenharmony_ci+      auto prim_offset =
729be168c0dSopenharmony_ci+        schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_BATCH_TO_SPACE), ops_offset.o);
730be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
731be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, prim);
732be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
733be168c0dSopenharmony_ci+      *primitive = ret_value;
734be168c0dSopenharmony_ci+    }
735be168c0dSopenharmony_ci+  }
736be168c0dSopenharmony_ci+}
737be168c0dSopenharmony_ci+
738be168c0dSopenharmony_ci // ********** Custom **********
739be168c0dSopenharmony_ci std::vector<const mindspore::schema::Attribute *> MindIR_Custom_GetAttr(ConstPrimitivePtr primitive) {
740be168c0dSopenharmony_ci   if (primitive == nullptr) {
741be168c0dSopenharmony_cidiff --git a/mindspore/lite/mindir/src/mindir_1.cc b/mindspore/lite/mindir/src/mindir_1.cc
742be168c0dSopenharmony_cinew file mode 100644
743be168c0dSopenharmony_ciindex 00000000..5177e881
744be168c0dSopenharmony_ci--- /dev/null
745be168c0dSopenharmony_ci+++ b/mindspore/lite/mindir/src/mindir_1.cc
746be168c0dSopenharmony_ci@@ -0,0 +1,2061 @@
747be168c0dSopenharmony_ci+/**
748be168c0dSopenharmony_ci+ * Copyright 2024 Huawei Technologies Co., Ltd
749be168c0dSopenharmony_ci+ *
750be168c0dSopenharmony_ci+ * Licensed under the Apache License, Version 2.0 (the "License");
751be168c0dSopenharmony_ci+ * you may not use this file except in compliance with the License.
752be168c0dSopenharmony_ci+ * You may obtain a copy of the License at
753be168c0dSopenharmony_ci+ *
754be168c0dSopenharmony_ci+ * http://www.apache.org/licenses/LICENSE-2.0
755be168c0dSopenharmony_ci+ *
756be168c0dSopenharmony_ci+ * Unless required by applicable law or agreed to in writing, software
757be168c0dSopenharmony_ci+ * distributed under the License is distributed on an "AS IS" BASIS,
758be168c0dSopenharmony_ci+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
759be168c0dSopenharmony_ci+ * See the License for the specific language governing permissions and
760be168c0dSopenharmony_ci+ * limitations under the License.
761be168c0dSopenharmony_ci+ */
762be168c0dSopenharmony_ci+
763be168c0dSopenharmony_ci+#include "mindir.h"
764be168c0dSopenharmony_ci+#include "utils.h"
765be168c0dSopenharmony_ci+#include "schema/model_generated.h"
766be168c0dSopenharmony_ci+#include "mindir_memory_manager.h"
767be168c0dSopenharmony_ci+
768be168c0dSopenharmony_ci+namespace mindspore {
769be168c0dSopenharmony_ci+namespace lite {
770be168c0dSopenharmony_ci+// ********** Depend **********
771be168c0dSopenharmony_ci+PrimitivePtr MindIR_Depend_CreatePrimitive() {
772be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
773be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateDepend(fbb);
774be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_DEPEND), ops_offset.o);
775be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
776be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
777be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
778be168c0dSopenharmony_ci+  return ret_value;
779be168c0dSopenharmony_ci+}
780be168c0dSopenharmony_ci+
781be168c0dSopenharmony_ci+// ********** Dropout **********
782be168c0dSopenharmony_ci+PrimitivePtr MindIR_Dropout_CreatePrimitive(float keep_prob) {
783be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
784be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateDropout(fbb, keep_prob);
785be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_DROPOUT), ops_offset.o);
786be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
787be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
788be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
789be168c0dSopenharmony_ci+  return ret_value;
790be168c0dSopenharmony_ci+}
791be168c0dSopenharmony_ci+
792be168c0dSopenharmony_ci+float MindIR_Dropout_GetKeepProb(ConstPrimitivePtr primitive) {
793be168c0dSopenharmony_ci+  if (primitive != nullptr) {
794be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
795be168c0dSopenharmony_ci+    auto value = prim->value_as_Dropout();
796be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
797be168c0dSopenharmony_ci+      return value->keep_prob();
798be168c0dSopenharmony_ci+    } else {
799be168c0dSopenharmony_ci+      return .0;
800be168c0dSopenharmony_ci+    }
801be168c0dSopenharmony_ci+  } else {
802be168c0dSopenharmony_ci+    return .0;
803be168c0dSopenharmony_ci+  }
804be168c0dSopenharmony_ci+}
805be168c0dSopenharmony_ci+
806be168c0dSopenharmony_ci+void MindIR_Dropout_SetKeepProb(PrimitivePtr *primitive, float keep_prob) {
807be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
808be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
809be168c0dSopenharmony_ci+    auto value = prim->value_as_Dropout();
810be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
811be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
812be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateDropout(fbb, keep_prob);
813be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_DROPOUT), ops_offset.o);
814be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
815be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, prim);
816be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
817be168c0dSopenharmony_ci+      *primitive = ret_value;
818be168c0dSopenharmony_ci+    }
819be168c0dSopenharmony_ci+  }
820be168c0dSopenharmony_ci+}
821be168c0dSopenharmony_ci+
822be168c0dSopenharmony_ci+// ********** Elu **********
823be168c0dSopenharmony_ci+PrimitivePtr MindIR_Elu_CreatePrimitive(float alpha) {
824be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
825be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateElu(fbb, alpha);
826be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_ELU), ops_offset.o);
827be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
828be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
829be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
830be168c0dSopenharmony_ci+  return ret_value;
831be168c0dSopenharmony_ci+}
832be168c0dSopenharmony_ci+
833be168c0dSopenharmony_ci+float MindIR_Elu_GetAlpha(ConstPrimitivePtr primitive) {
834be168c0dSopenharmony_ci+  if (primitive != nullptr) {
835be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
836be168c0dSopenharmony_ci+    auto value = prim->value_as_Elu();
837be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
838be168c0dSopenharmony_ci+      return value->alpha();
839be168c0dSopenharmony_ci+    } else {
840be168c0dSopenharmony_ci+      return .0;
841be168c0dSopenharmony_ci+    }
842be168c0dSopenharmony_ci+  } else {
843be168c0dSopenharmony_ci+    return .0;
844be168c0dSopenharmony_ci+  }
845be168c0dSopenharmony_ci+}
846be168c0dSopenharmony_ci+
847be168c0dSopenharmony_ci+void MindIR_Elu_SetAlpha(PrimitivePtr *primitive, float alpha) {
848be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
849be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
850be168c0dSopenharmony_ci+    auto value = prim->value_as_Elu();
851be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
852be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
853be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateElu(fbb, alpha);
854be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_ELU), ops_offset.o);
855be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
856be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, prim);
857be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
858be168c0dSopenharmony_ci+      *primitive = ret_value;
859be168c0dSopenharmony_ci+    }
860be168c0dSopenharmony_ci+  }
861be168c0dSopenharmony_ci+}
862be168c0dSopenharmony_ci+
863be168c0dSopenharmony_ci+// ********** EmbeddingLookupFusion **********
864be168c0dSopenharmony_ci+PrimitivePtr MindIR_EmbeddingLookupFusion_CreatePrimitive(float max_norm) {
865be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
866be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateEmbeddingLookupFusion(fbb, max_norm);
867be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_EMBEDDING_LOOKUP_FUSION), ops_offset.o);
868be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
869be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
870be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
871be168c0dSopenharmony_ci+  return ret_value;
872be168c0dSopenharmony_ci+}
873be168c0dSopenharmony_ci+
874be168c0dSopenharmony_ci+float MindIR_EmbeddingLookupFusion_GetMaxNorm(ConstPrimitivePtr primitive) {
875be168c0dSopenharmony_ci+  if (primitive != nullptr) {
876be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
877be168c0dSopenharmony_ci+    auto value = prim->value_as_EmbeddingLookupFusion();
878be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
879be168c0dSopenharmony_ci+      return value->max_norm();
880be168c0dSopenharmony_ci+    } else {
881be168c0dSopenharmony_ci+      return .0;
882be168c0dSopenharmony_ci+    }
883be168c0dSopenharmony_ci+  } else {
884be168c0dSopenharmony_ci+    return .0;
885be168c0dSopenharmony_ci+  }
886be168c0dSopenharmony_ci+}
887be168c0dSopenharmony_ci+
888be168c0dSopenharmony_ci+void MindIR_EmbeddingLookupFusion_SetMaxNorm(PrimitivePtr *primitive, float max_norm) {
889be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
890be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
891be168c0dSopenharmony_ci+    auto value = prim->value_as_EmbeddingLookupFusion();
892be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
893be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
894be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateEmbeddingLookupFusion(fbb, max_norm);
895be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_EMBEDDING_LOOKUP_FUSION), ops_offset.o);
896be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
897be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, prim);
898be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
899be168c0dSopenharmony_ci+      *primitive = ret_value;
900be168c0dSopenharmony_ci+    }
901be168c0dSopenharmony_ci+  }
902be168c0dSopenharmony_ci+}
903be168c0dSopenharmony_ci+
904be168c0dSopenharmony_ci+// ********** FakeQuantWithMinMaxVars **********
905be168c0dSopenharmony_ci+PrimitivePtr MindIR_FakeQuantWithMinMaxVars_CreatePrimitive(int64_t num_bits, bool narrow_range) {
906be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
907be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateFakeQuantWithMinMaxVars(fbb, num_bits, narrow_range);
908be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_FAKE_QUANT_WITH_MIN_MAX_VARS), ops_offset.o);
909be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
910be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
911be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
912be168c0dSopenharmony_ci+  return ret_value;
913be168c0dSopenharmony_ci+}
914be168c0dSopenharmony_ci+
915be168c0dSopenharmony_ci+int64_t MindIR_FakeQuantWithMinMaxVars_GetNumBits(ConstPrimitivePtr primitive) {
916be168c0dSopenharmony_ci+  if (primitive != nullptr) {
917be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
918be168c0dSopenharmony_ci+    auto value = prim->value_as_FakeQuantWithMinMaxVars();
919be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
920be168c0dSopenharmony_ci+      return value->num_bits();
921be168c0dSopenharmony_ci+    } else {
922be168c0dSopenharmony_ci+      return 0;
923be168c0dSopenharmony_ci+    }
924be168c0dSopenharmony_ci+  } else {
925be168c0dSopenharmony_ci+    return 0;
926be168c0dSopenharmony_ci+  }
927be168c0dSopenharmony_ci+}
928be168c0dSopenharmony_ci+
929be168c0dSopenharmony_ci+void MindIR_FakeQuantWithMinMaxVars_SetNumBits(PrimitivePtr *primitive, int64_t num_bits) {
930be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
931be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
932be168c0dSopenharmony_ci+    auto value = prim->value_as_FakeQuantWithMinMaxVars();
933be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
934be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
935be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateFakeQuantWithMinMaxVars(fbb, num_bits, value->narrow_range());
936be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_FAKE_QUANT_WITH_MIN_MAX_VARS), ops_offset.o);
937be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
938be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
939be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
940be168c0dSopenharmony_ci+      free(*primitive);
941be168c0dSopenharmony_ci+      *primitive = ret_value;
942be168c0dSopenharmony_ci+    }
943be168c0dSopenharmony_ci+  }
944be168c0dSopenharmony_ci+}
945be168c0dSopenharmony_ci+
946be168c0dSopenharmony_ci+bool MindIR_FakeQuantWithMinMaxVars_GetNarrowRange(ConstPrimitivePtr primitive) {
947be168c0dSopenharmony_ci+  if (primitive != nullptr) {
948be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
949be168c0dSopenharmony_ci+    auto value = prim->value_as_FakeQuantWithMinMaxVars();
950be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
951be168c0dSopenharmony_ci+      return value->narrow_range();
952be168c0dSopenharmony_ci+    } else {
953be168c0dSopenharmony_ci+      return false;
954be168c0dSopenharmony_ci+    }
955be168c0dSopenharmony_ci+  } else {
956be168c0dSopenharmony_ci+    return false;
957be168c0dSopenharmony_ci+  }
958be168c0dSopenharmony_ci+}
959be168c0dSopenharmony_ci+
960be168c0dSopenharmony_ci+void MindIR_FakeQuantWithMinMaxVars_SetNarrowRange(PrimitivePtr *primitive, bool narrow_range) {
961be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
962be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
963be168c0dSopenharmony_ci+    auto value = prim->value_as_FakeQuantWithMinMaxVars();
964be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
965be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
966be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateFakeQuantWithMinMaxVars(fbb, value->num_bits(), narrow_range);
967be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_FAKE_QUANT_WITH_MIN_MAX_VARS), ops_offset.o);
968be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
969be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
970be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
971be168c0dSopenharmony_ci+      free(*primitive);
972be168c0dSopenharmony_ci+      *primitive = ret_value;
973be168c0dSopenharmony_ci+    }
974be168c0dSopenharmony_ci+  }
975be168c0dSopenharmony_ci+}
976be168c0dSopenharmony_ci+
977be168c0dSopenharmony_ci+// ********** FakeQuantWithMinMaxVarsPerChannel **********
978be168c0dSopenharmony_ci+PrimitivePtr MindIR_FakeQuantWithMinMaxVarsPerChannel_CreatePrimitive(int64_t num_bits, bool narrow_range) {
979be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
980be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateFakeQuantWithMinMaxVarsPerChannel(fbb, num_bits, narrow_range);
981be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_FAKE_QUANT_WITH_MIN_MAX_VARS_PER_CHANNEL), ops_offset.o);
982be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
983be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
984be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
985be168c0dSopenharmony_ci+  return ret_value;
986be168c0dSopenharmony_ci+}
987be168c0dSopenharmony_ci+
988be168c0dSopenharmony_ci+int64_t MindIR_FakeQuantWithMinMaxVarsPerChannel_GetNumBits(ConstPrimitivePtr primitive) {
989be168c0dSopenharmony_ci+  if (primitive != nullptr) {
990be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
991be168c0dSopenharmony_ci+    auto value = prim->value_as_FakeQuantWithMinMaxVarsPerChannel();
992be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
993be168c0dSopenharmony_ci+      return value->num_bits();
994be168c0dSopenharmony_ci+    } else {
995be168c0dSopenharmony_ci+      return 0;
996be168c0dSopenharmony_ci+    }
997be168c0dSopenharmony_ci+  } else {
998be168c0dSopenharmony_ci+    return 0;
999be168c0dSopenharmony_ci+  }
1000be168c0dSopenharmony_ci+}
1001be168c0dSopenharmony_ci+
1002be168c0dSopenharmony_ci+void MindIR_FakeQuantWithMinMaxVarsPerChannel_SetNumBits(PrimitivePtr *primitive, int64_t num_bits) {
1003be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1004be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1005be168c0dSopenharmony_ci+    auto value = prim->value_as_FakeQuantWithMinMaxVarsPerChannel();
1006be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1007be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1008be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateFakeQuantWithMinMaxVarsPerChannel(fbb, num_bits, value->narrow_range());
1009be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_FAKE_QUANT_WITH_MIN_MAX_VARS_PER_CHANNEL), ops_offset.o);
1010be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1011be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1012be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1013be168c0dSopenharmony_ci+      free(*primitive);
1014be168c0dSopenharmony_ci+      *primitive = ret_value;
1015be168c0dSopenharmony_ci+    }
1016be168c0dSopenharmony_ci+  }
1017be168c0dSopenharmony_ci+}
1018be168c0dSopenharmony_ci+
1019be168c0dSopenharmony_ci+bool MindIR_FakeQuantWithMinMaxVarsPerChannel_GetNarrowRange(ConstPrimitivePtr primitive) {
1020be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1021be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1022be168c0dSopenharmony_ci+    auto value = prim->value_as_FakeQuantWithMinMaxVarsPerChannel();
1023be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1024be168c0dSopenharmony_ci+      return value->narrow_range();
1025be168c0dSopenharmony_ci+    } else {
1026be168c0dSopenharmony_ci+      return false;
1027be168c0dSopenharmony_ci+    }
1028be168c0dSopenharmony_ci+  } else {
1029be168c0dSopenharmony_ci+    return false;
1030be168c0dSopenharmony_ci+  }
1031be168c0dSopenharmony_ci+}
1032be168c0dSopenharmony_ci+
1033be168c0dSopenharmony_ci+void MindIR_FakeQuantWithMinMaxVarsPerChannel_SetNarrowRange(PrimitivePtr *primitive, bool narrow_range) {
1034be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1035be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1036be168c0dSopenharmony_ci+    auto value = prim->value_as_FakeQuantWithMinMaxVarsPerChannel();
1037be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1038be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1039be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateFakeQuantWithMinMaxVarsPerChannel(fbb, value->num_bits(), narrow_range);
1040be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_FAKE_QUANT_WITH_MIN_MAX_VARS_PER_CHANNEL), ops_offset.o);
1041be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1042be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1043be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1044be168c0dSopenharmony_ci+      free(*primitive);
1045be168c0dSopenharmony_ci+      *primitive = ret_value;
1046be168c0dSopenharmony_ci+    }
1047be168c0dSopenharmony_ci+  }
1048be168c0dSopenharmony_ci+}
1049be168c0dSopenharmony_ci+
1050be168c0dSopenharmony_ci+// ********** FftReal **********
1051be168c0dSopenharmony_ci+PrimitivePtr MindIR_FftReal_CreatePrimitive() {
1052be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
1053be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateFftReal(fbb);
1054be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_FFT_REAL), ops_offset.o);
1055be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
1056be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1057be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1058be168c0dSopenharmony_ci+  return ret_value;
1059be168c0dSopenharmony_ci+}
1060be168c0dSopenharmony_ci+
1061be168c0dSopenharmony_ci+// ********** FftImag **********
1062be168c0dSopenharmony_ci+PrimitivePtr MindIR_FftImag_CreatePrimitive() {
1063be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
1064be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateFftImag(fbb);
1065be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_FFT_IMAG), ops_offset.o);
1066be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
1067be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1068be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1069be168c0dSopenharmony_ci+  return ret_value;
1070be168c0dSopenharmony_ci+}
1071be168c0dSopenharmony_ci+
1072be168c0dSopenharmony_ci+// ********** FloorDiv **********
1073be168c0dSopenharmony_ci+PrimitivePtr MindIR_FloorDiv_CreatePrimitive() {
1074be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
1075be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateFloorDiv(fbb);
1076be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_FLOOR_DIV), ops_offset.o);
1077be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
1078be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1079be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1080be168c0dSopenharmony_ci+  return ret_value;
1081be168c0dSopenharmony_ci+}
1082be168c0dSopenharmony_ci+
1083be168c0dSopenharmony_ci+// ********** FloorMod **********
1084be168c0dSopenharmony_ci+PrimitivePtr MindIR_FloorMod_CreatePrimitive() {
1085be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
1086be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateFloorMod(fbb);
1087be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_FLOOR_MOD), ops_offset.o);
1088be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
1089be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1090be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1091be168c0dSopenharmony_ci+  return ret_value;
1092be168c0dSopenharmony_ci+}
1093be168c0dSopenharmony_ci+
1094be168c0dSopenharmony_ci+// ********** HashtableLookup **********
1095be168c0dSopenharmony_ci+PrimitivePtr MindIR_HashtableLookup_CreatePrimitive() {
1096be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
1097be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateHashtableLookup(fbb);
1098be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_HASHTABLE_LOOKUP), ops_offset.o);
1099be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
1100be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1101be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1102be168c0dSopenharmony_ci+  return ret_value;
1103be168c0dSopenharmony_ci+}
1104be168c0dSopenharmony_ci+
1105be168c0dSopenharmony_ci+// ********** LpNormalization **********
1106be168c0dSopenharmony_ci+PrimitivePtr MindIR_LpNormalization_CreatePrimitive(int64_t axis, int64_t p) {
1107be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
1108be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateLpNormalization(fbb, axis, p);
1109be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_LP_NORMALIZATION), ops_offset.o);
1110be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
1111be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1112be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1113be168c0dSopenharmony_ci+  return ret_value;
1114be168c0dSopenharmony_ci+}
1115be168c0dSopenharmony_ci+
1116be168c0dSopenharmony_ci+int64_t MindIR_LpNormalization_GetAxis(ConstPrimitivePtr primitive) {
1117be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1118be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1119be168c0dSopenharmony_ci+    auto value = prim->value_as_LpNormalization();
1120be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1121be168c0dSopenharmony_ci+      return value->axis();
1122be168c0dSopenharmony_ci+    } else {
1123be168c0dSopenharmony_ci+      return 0;
1124be168c0dSopenharmony_ci+    }
1125be168c0dSopenharmony_ci+  } else {
1126be168c0dSopenharmony_ci+    return 0;
1127be168c0dSopenharmony_ci+  }
1128be168c0dSopenharmony_ci+}
1129be168c0dSopenharmony_ci+
1130be168c0dSopenharmony_ci+void MindIR_LpNormalization_SetAxis(PrimitivePtr *primitive, int64_t axis) {
1131be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1132be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1133be168c0dSopenharmony_ci+    auto value = prim->value_as_LpNormalization();
1134be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1135be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1136be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateLpNormalization(fbb, axis, value->p());
1137be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_LP_NORMALIZATION), ops_offset.o);
1138be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1139be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, prim);
1140be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1141be168c0dSopenharmony_ci+      *primitive = ret_value;
1142be168c0dSopenharmony_ci+    }
1143be168c0dSopenharmony_ci+  }
1144be168c0dSopenharmony_ci+}
1145be168c0dSopenharmony_ci+
1146be168c0dSopenharmony_ci+int64_t MindIR_LpNormalization_GetP(ConstPrimitivePtr primitive) {
1147be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1148be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1149be168c0dSopenharmony_ci+    auto value = prim->value_as_LpNormalization();
1150be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1151be168c0dSopenharmony_ci+      return value->p();
1152be168c0dSopenharmony_ci+    } else {
1153be168c0dSopenharmony_ci+      return 0;
1154be168c0dSopenharmony_ci+    }
1155be168c0dSopenharmony_ci+  } else {
1156be168c0dSopenharmony_ci+    return 0;
1157be168c0dSopenharmony_ci+  }
1158be168c0dSopenharmony_ci+}
1159be168c0dSopenharmony_ci+
1160be168c0dSopenharmony_ci+void MindIR_LpNormalization_SetP(PrimitivePtr *primitive, int64_t p) {
1161be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1162be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1163be168c0dSopenharmony_ci+    auto value = prim->value_as_LpNormalization();
1164be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1165be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1166be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateLpNormalization(fbb, value->axis(), p);
1167be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_LP_NORMALIZATION), ops_offset.o);
1168be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1169be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, prim);
1170be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1171be168c0dSopenharmony_ci+      *primitive = ret_value;
1172be168c0dSopenharmony_ci+    }
1173be168c0dSopenharmony_ci+  }
1174be168c0dSopenharmony_ci+}
1175be168c0dSopenharmony_ci+
1176be168c0dSopenharmony_ci+// ********** LshProjection **********
1177be168c0dSopenharmony_ci+PrimitivePtr MindIR_LshProjection_CreatePrimitive(LshProjectionType type) {
1178be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
1179be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateLshProjection(fbb, static_cast<schema::LshProjectionType>(type));
1180be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_LSH_PROJECTION), ops_offset.o);
1181be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
1182be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1183be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1184be168c0dSopenharmony_ci+  return ret_value;
1185be168c0dSopenharmony_ci+}
1186be168c0dSopenharmony_ci+
1187be168c0dSopenharmony_ci+LshProjectionType MindIR_LshProjection_GetType(ConstPrimitivePtr primitive) {
1188be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1189be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1190be168c0dSopenharmony_ci+    auto value = prim->value_as_LshProjection();
1191be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1192be168c0dSopenharmony_ci+      return static_cast<LshProjectionType>(value->type());
1193be168c0dSopenharmony_ci+    } else {
1194be168c0dSopenharmony_ci+      LshProjectionType en = static_cast<LshProjectionType>(0);
1195be168c0dSopenharmony_ci+      return en;
1196be168c0dSopenharmony_ci+    }
1197be168c0dSopenharmony_ci+  } else {
1198be168c0dSopenharmony_ci+    LshProjectionType en = static_cast<LshProjectionType>(0);
1199be168c0dSopenharmony_ci+    return en;
1200be168c0dSopenharmony_ci+  }
1201be168c0dSopenharmony_ci+}
1202be168c0dSopenharmony_ci+
1203be168c0dSopenharmony_ci+void MindIR_LshProjection_SetType(PrimitivePtr *primitive, LshProjectionType type) {
1204be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1205be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1206be168c0dSopenharmony_ci+    auto value = prim->value_as_LshProjection();
1207be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1208be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1209be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateLshProjection(fbb, static_cast<schema::LshProjectionType>(type));
1210be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_LSH_PROJECTION), ops_offset.o);
1211be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1212be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1213be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1214be168c0dSopenharmony_ci+      free(*primitive);
1215be168c0dSopenharmony_ci+      *primitive = ret_value;
1216be168c0dSopenharmony_ci+    }
1217be168c0dSopenharmony_ci+  }
1218be168c0dSopenharmony_ci+}
1219be168c0dSopenharmony_ci+
1220be168c0dSopenharmony_ci+// ********** SwitchLayer **********
1221be168c0dSopenharmony_ci+PrimitivePtr MindIR_SwitchLayer_CreatePrimitive() {
1222be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
1223be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateSwitchLayer(fbb);
1224be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SWITCH_LAYER), ops_offset.o);
1225be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
1226be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1227be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1228be168c0dSopenharmony_ci+  return ret_value;
1229be168c0dSopenharmony_ci+}
1230be168c0dSopenharmony_ci+
1231be168c0dSopenharmony_ci+// ********** Mfcc **********
1232be168c0dSopenharmony_ci+PrimitivePtr MindIR_Mfcc_CreatePrimitive(float freq_upper_limit, float freq_lower_limit, int64_t filter_bank_channel_num, int64_t dct_coeff_num) {
1233be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
1234be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateMfcc(fbb, freq_upper_limit, freq_lower_limit, filter_bank_channel_num, dct_coeff_num);
1235be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_MFCC), ops_offset.o);
1236be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
1237be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1238be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1239be168c0dSopenharmony_ci+  return ret_value;
1240be168c0dSopenharmony_ci+}
1241be168c0dSopenharmony_ci+
1242be168c0dSopenharmony_ci+float MindIR_Mfcc_GetFreqUpperLimit(ConstPrimitivePtr primitive) {
1243be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1244be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1245be168c0dSopenharmony_ci+    auto value = prim->value_as_Mfcc();
1246be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1247be168c0dSopenharmony_ci+      return value->freq_upper_limit();
1248be168c0dSopenharmony_ci+    } else {
1249be168c0dSopenharmony_ci+      return .0;
1250be168c0dSopenharmony_ci+    }
1251be168c0dSopenharmony_ci+  } else {
1252be168c0dSopenharmony_ci+    return .0;
1253be168c0dSopenharmony_ci+  }
1254be168c0dSopenharmony_ci+}
1255be168c0dSopenharmony_ci+
1256be168c0dSopenharmony_ci+void MindIR_Mfcc_SetFreqUpperLimit(PrimitivePtr *primitive, float freq_upper_limit) {
1257be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1258be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1259be168c0dSopenharmony_ci+    auto value = prim->value_as_Mfcc();
1260be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1261be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1262be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateMfcc(fbb, freq_upper_limit, value->freq_lower_limit(), value->filter_bank_channel_num(), value->dct_coeff_num());
1263be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_MFCC), ops_offset.o);
1264be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1265be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1266be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1267be168c0dSopenharmony_ci+      free(*primitive);
1268be168c0dSopenharmony_ci+      *primitive = ret_value;
1269be168c0dSopenharmony_ci+    }
1270be168c0dSopenharmony_ci+  }
1271be168c0dSopenharmony_ci+}
1272be168c0dSopenharmony_ci+
1273be168c0dSopenharmony_ci+float MindIR_Mfcc_GetFreqLowerLimit(ConstPrimitivePtr primitive) {
1274be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1275be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1276be168c0dSopenharmony_ci+    auto value = prim->value_as_Mfcc();
1277be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1278be168c0dSopenharmony_ci+      return value->freq_lower_limit();
1279be168c0dSopenharmony_ci+    } else {
1280be168c0dSopenharmony_ci+      return .0;
1281be168c0dSopenharmony_ci+    }
1282be168c0dSopenharmony_ci+  } else {
1283be168c0dSopenharmony_ci+    return .0;
1284be168c0dSopenharmony_ci+  }
1285be168c0dSopenharmony_ci+}
1286be168c0dSopenharmony_ci+
1287be168c0dSopenharmony_ci+void MindIR_Mfcc_SetFreqLowerLimit(PrimitivePtr *primitive, float freq_lower_limit) {
1288be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1289be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1290be168c0dSopenharmony_ci+    auto value = prim->value_as_Mfcc();
1291be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1292be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1293be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateMfcc(fbb, value->freq_upper_limit(), freq_lower_limit, value->filter_bank_channel_num(), value->dct_coeff_num());
1294be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_MFCC), ops_offset.o);
1295be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1296be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1297be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1298be168c0dSopenharmony_ci+      free(*primitive);
1299be168c0dSopenharmony_ci+      *primitive = ret_value;
1300be168c0dSopenharmony_ci+    }
1301be168c0dSopenharmony_ci+  }
1302be168c0dSopenharmony_ci+}
1303be168c0dSopenharmony_ci+
1304be168c0dSopenharmony_ci+int64_t MindIR_Mfcc_GetFilterBankChannelNum(ConstPrimitivePtr primitive) {
1305be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1306be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1307be168c0dSopenharmony_ci+    auto value = prim->value_as_Mfcc();
1308be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1309be168c0dSopenharmony_ci+      return value->filter_bank_channel_num();
1310be168c0dSopenharmony_ci+    } else {
1311be168c0dSopenharmony_ci+      return 0;
1312be168c0dSopenharmony_ci+    }
1313be168c0dSopenharmony_ci+  } else {
1314be168c0dSopenharmony_ci+    return 0;
1315be168c0dSopenharmony_ci+  }
1316be168c0dSopenharmony_ci+}
1317be168c0dSopenharmony_ci+
1318be168c0dSopenharmony_ci+void MindIR_Mfcc_SetFilterBankChannelNum(PrimitivePtr *primitive, int64_t filter_bank_channel_num) {
1319be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1320be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1321be168c0dSopenharmony_ci+    auto value = prim->value_as_Mfcc();
1322be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1323be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1324be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateMfcc(fbb, value->freq_upper_limit(), value->freq_lower_limit(), filter_bank_channel_num, value->dct_coeff_num());
1325be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_MFCC), ops_offset.o);
1326be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1327be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1328be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1329be168c0dSopenharmony_ci+      free(*primitive);
1330be168c0dSopenharmony_ci+      *primitive = ret_value;
1331be168c0dSopenharmony_ci+    }
1332be168c0dSopenharmony_ci+  }
1333be168c0dSopenharmony_ci+}
1334be168c0dSopenharmony_ci+
1335be168c0dSopenharmony_ci+int64_t MindIR_Mfcc_GetDctCoeffNum(ConstPrimitivePtr primitive) {
1336be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1337be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1338be168c0dSopenharmony_ci+    auto value = prim->value_as_Mfcc();
1339be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1340be168c0dSopenharmony_ci+      return value->dct_coeff_num();
1341be168c0dSopenharmony_ci+    } else {
1342be168c0dSopenharmony_ci+      return 0;
1343be168c0dSopenharmony_ci+    }
1344be168c0dSopenharmony_ci+  } else {
1345be168c0dSopenharmony_ci+    return 0;
1346be168c0dSopenharmony_ci+  }
1347be168c0dSopenharmony_ci+}
1348be168c0dSopenharmony_ci+
1349be168c0dSopenharmony_ci+void MindIR_Mfcc_SetDctCoeffNum(PrimitivePtr *primitive, int64_t dct_coeff_num) {
1350be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1351be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1352be168c0dSopenharmony_ci+    auto value = prim->value_as_Mfcc();
1353be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1354be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1355be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateMfcc(fbb, value->freq_upper_limit(), value->freq_lower_limit(), value->filter_bank_channel_num(), dct_coeff_num);
1356be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_MFCC), ops_offset.o);
1357be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1358be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1359be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1360be168c0dSopenharmony_ci+      free(*primitive);
1361be168c0dSopenharmony_ci+      *primitive = ret_value;
1362be168c0dSopenharmony_ci+    }
1363be168c0dSopenharmony_ci+  }
1364be168c0dSopenharmony_ci+}
1365be168c0dSopenharmony_ci+
1366be168c0dSopenharmony_ci+// ********** NonMaxSuppression **********
1367be168c0dSopenharmony_ci+PrimitivePtr MindIR_NonMaxSuppression_CreatePrimitive(int64_t center_point_box) {
1368be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
1369be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateNonMaxSuppression(fbb, center_point_box);
1370be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_NON_MAX_SUPPRESSION), ops_offset.o);
1371be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
1372be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1373be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1374be168c0dSopenharmony_ci+  return ret_value;
1375be168c0dSopenharmony_ci+}
1376be168c0dSopenharmony_ci+
1377be168c0dSopenharmony_ci+int64_t MindIR_NonMaxSuppression_GetCenterPointBox(ConstPrimitivePtr primitive) {
1378be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1379be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1380be168c0dSopenharmony_ci+    auto value = prim->value_as_NonMaxSuppression();
1381be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1382be168c0dSopenharmony_ci+      return value->center_point_box();
1383be168c0dSopenharmony_ci+    } else {
1384be168c0dSopenharmony_ci+      return 0;
1385be168c0dSopenharmony_ci+    }
1386be168c0dSopenharmony_ci+  } else {
1387be168c0dSopenharmony_ci+    return 0;
1388be168c0dSopenharmony_ci+  }
1389be168c0dSopenharmony_ci+}
1390be168c0dSopenharmony_ci+
1391be168c0dSopenharmony_ci+void MindIR_NonMaxSuppression_SetCenterPointBox(PrimitivePtr *primitive, int64_t center_point_box) {
1392be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1393be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1394be168c0dSopenharmony_ci+    auto value = prim->value_as_NonMaxSuppression();
1395be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1396be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1397be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateNonMaxSuppression(fbb, center_point_box);
1398be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_NON_MAX_SUPPRESSION), ops_offset.o);
1399be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1400be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1401be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1402be168c0dSopenharmony_ci+      free(*primitive);
1403be168c0dSopenharmony_ci+      *primitive = ret_value;
1404be168c0dSopenharmony_ci+    }
1405be168c0dSopenharmony_ci+  }
1406be168c0dSopenharmony_ci+}
1407be168c0dSopenharmony_ci+
1408be168c0dSopenharmony_ci+// ********** OnesLike **********
1409be168c0dSopenharmony_ci+PrimitivePtr MindIR_OnesLike_CreatePrimitive() {
1410be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
1411be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateOnesLike(fbb);
1412be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_ONES_LIKE), ops_offset.o);
1413be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
1414be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1415be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1416be168c0dSopenharmony_ci+  return ret_value;
1417be168c0dSopenharmony_ci+}
1418be168c0dSopenharmony_ci+
1419be168c0dSopenharmony_ci+// ********** PartialFusion **********
1420be168c0dSopenharmony_ci+PrimitivePtr MindIR_PartialFusion_CreatePrimitive(int64_t sub_graph_index) {
1421be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
1422be168c0dSopenharmony_ci+  auto ops_offset = schema::CreatePartialFusion(fbb, sub_graph_index);
1423be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_PARTIAL_FUSION), ops_offset.o);
1424be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
1425be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1426be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1427be168c0dSopenharmony_ci+  return ret_value;
1428be168c0dSopenharmony_ci+}
1429be168c0dSopenharmony_ci+
1430be168c0dSopenharmony_ci+int64_t MindIR_PartialFusion_GetSubGraphIndex(ConstPrimitivePtr primitive) {
1431be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1432be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1433be168c0dSopenharmony_ci+    auto value = prim->value_as_PartialFusion();
1434be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1435be168c0dSopenharmony_ci+      return value->sub_graph_index();
1436be168c0dSopenharmony_ci+    } else {
1437be168c0dSopenharmony_ci+      return 0;
1438be168c0dSopenharmony_ci+    }
1439be168c0dSopenharmony_ci+  } else {
1440be168c0dSopenharmony_ci+    return 0;
1441be168c0dSopenharmony_ci+  }
1442be168c0dSopenharmony_ci+}
1443be168c0dSopenharmony_ci+
1444be168c0dSopenharmony_ci+void MindIR_PartialFusion_SetSubGraphIndex(PrimitivePtr *primitive, int64_t sub_graph_index) {
1445be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1446be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1447be168c0dSopenharmony_ci+    auto value = prim->value_as_PartialFusion();
1448be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1449be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1450be168c0dSopenharmony_ci+      auto ops_offset = schema::CreatePartialFusion(fbb, sub_graph_index);
1451be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_PARTIAL_FUSION), ops_offset.o);
1452be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1453be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1454be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1455be168c0dSopenharmony_ci+      free(*primitive);
1456be168c0dSopenharmony_ci+      *primitive = ret_value;
1457be168c0dSopenharmony_ci+    }
1458be168c0dSopenharmony_ci+  }
1459be168c0dSopenharmony_ci+}
1460be168c0dSopenharmony_ci+
1461be168c0dSopenharmony_ci+// ********** PriorBox **********
1462be168c0dSopenharmony_ci+PrimitivePtr MindIR_PriorBox_CreatePrimitive(const std::vector<int64_t> &min_sizes, const std::vector<int64_t> &max_sizes, const std::vector<float> &aspect_ratios, const std::vector<float> &variances, int64_t image_size_w, int64_t image_size_h, float step_w, float step_h, bool clip, bool flip, float offset) {
1463be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
1464be168c0dSopenharmony_ci+  auto ops_offset = schema::CreatePriorBox(fbb, fbb.CreateVector(min_sizes.data(), min_sizes.size()), fbb.CreateVector(max_sizes.data(), max_sizes.size()), fbb.CreateVector(aspect_ratios.data(), aspect_ratios.size()), fbb.CreateVector(variances.data(), variances.size()), image_size_w, image_size_h, step_w, step_h, clip, flip, offset);
1465be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_PRIOR_BOX), ops_offset.o);
1466be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
1467be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1468be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1469be168c0dSopenharmony_ci+  return ret_value;
1470be168c0dSopenharmony_ci+}
1471be168c0dSopenharmony_ci+
1472be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_PriorBox_GetMinSizes(ConstPrimitivePtr primitive) {
1473be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1474be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1475be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1476be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1477be168c0dSopenharmony_ci+      std::vector<int64_t> result;
1478be168c0dSopenharmony_ci+      auto src = value->min_sizes();
1479be168c0dSopenharmony_ci+      if (src == nullptr) {
1480be168c0dSopenharmony_ci+        return {};
1481be168c0dSopenharmony_ci+      }
1482be168c0dSopenharmony_ci+      result.resize(src->size());
1483be168c0dSopenharmony_ci+      std::transform(src->begin(), src->end(), result.begin(), [](int64_t item) { return item; });
1484be168c0dSopenharmony_ci+      return result;
1485be168c0dSopenharmony_ci+    } else {
1486be168c0dSopenharmony_ci+      return {};
1487be168c0dSopenharmony_ci+    }
1488be168c0dSopenharmony_ci+  } else {
1489be168c0dSopenharmony_ci+    return {};
1490be168c0dSopenharmony_ci+  }
1491be168c0dSopenharmony_ci+}
1492be168c0dSopenharmony_ci+
1493be168c0dSopenharmony_ci+void MindIR_PriorBox_SetMinSizes(PrimitivePtr *primitive, const std::vector<int64_t> &min_sizes) {
1494be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1495be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1496be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1497be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1498be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1499be168c0dSopenharmony_ci+      auto ops_offset = schema::CreatePriorBox(fbb, fbb.CreateVector(min_sizes.data(), min_sizes.size()), fbb.CreateVector(value->max_sizes()->data(), value->max_sizes()->size()), fbb.CreateVector(value->aspect_ratios()->data(), value->aspect_ratios()->size()), fbb.CreateVector(value->variances()->data(), value->variances()->size()), value->image_size_w(), value->image_size_h(), value->step_w(), value->step_h(), value->clip(), value->flip(), value->offset());
1500be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_PRIOR_BOX), ops_offset.o);
1501be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1502be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1503be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1504be168c0dSopenharmony_ci+      free(*primitive);
1505be168c0dSopenharmony_ci+      *primitive = ret_value;
1506be168c0dSopenharmony_ci+    }
1507be168c0dSopenharmony_ci+  }
1508be168c0dSopenharmony_ci+}
1509be168c0dSopenharmony_ci+
1510be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_PriorBox_GetMaxSizes(ConstPrimitivePtr primitive) {
1511be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1512be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1513be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1514be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1515be168c0dSopenharmony_ci+      std::vector<int64_t> result;
1516be168c0dSopenharmony_ci+      auto src = value->max_sizes();
1517be168c0dSopenharmony_ci+      if (src == nullptr) {
1518be168c0dSopenharmony_ci+        return {};
1519be168c0dSopenharmony_ci+      }
1520be168c0dSopenharmony_ci+      result.resize(src->size());
1521be168c0dSopenharmony_ci+      std::transform(src->begin(), src->end(), result.begin(), [](int64_t item) { return item; });
1522be168c0dSopenharmony_ci+      return result;
1523be168c0dSopenharmony_ci+    } else {
1524be168c0dSopenharmony_ci+      return {};
1525be168c0dSopenharmony_ci+    }
1526be168c0dSopenharmony_ci+  } else {
1527be168c0dSopenharmony_ci+    return {};
1528be168c0dSopenharmony_ci+  }
1529be168c0dSopenharmony_ci+}
1530be168c0dSopenharmony_ci+
1531be168c0dSopenharmony_ci+void MindIR_PriorBox_SetMaxSizes(PrimitivePtr *primitive, const std::vector<int64_t> &max_sizes) {
1532be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1533be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1534be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1535be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1536be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1537be168c0dSopenharmony_ci+      auto ops_offset = schema::CreatePriorBox(fbb, fbb.CreateVector(value->min_sizes()->data(), value->min_sizes()->size()), fbb.CreateVector(max_sizes.data(), max_sizes.size()), fbb.CreateVector(value->aspect_ratios()->data(), value->aspect_ratios()->size()), fbb.CreateVector(value->variances()->data(), value->variances()->size()), value->image_size_w(), value->image_size_h(), value->step_w(), value->step_h(), value->clip(), value->flip(), value->offset());
1538be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_PRIOR_BOX), ops_offset.o);
1539be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1540be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1541be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1542be168c0dSopenharmony_ci+      free(*primitive);
1543be168c0dSopenharmony_ci+      *primitive = ret_value;
1544be168c0dSopenharmony_ci+    }
1545be168c0dSopenharmony_ci+  }
1546be168c0dSopenharmony_ci+}
1547be168c0dSopenharmony_ci+
1548be168c0dSopenharmony_ci+std::vector<float> MindIR_PriorBox_GetAspectRatios(ConstPrimitivePtr primitive) {
1549be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1550be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1551be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1552be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1553be168c0dSopenharmony_ci+      std::vector<float> result;
1554be168c0dSopenharmony_ci+      auto src = value->aspect_ratios();
1555be168c0dSopenharmony_ci+      if (src == nullptr) {
1556be168c0dSopenharmony_ci+        return {};
1557be168c0dSopenharmony_ci+      }
1558be168c0dSopenharmony_ci+      result.resize(src->size());
1559be168c0dSopenharmony_ci+      std::transform(src->begin(), src->end(), result.begin(), [](float item) { return item; });
1560be168c0dSopenharmony_ci+      return result;
1561be168c0dSopenharmony_ci+    } else {
1562be168c0dSopenharmony_ci+      return {};
1563be168c0dSopenharmony_ci+    }
1564be168c0dSopenharmony_ci+  } else {
1565be168c0dSopenharmony_ci+    return {};
1566be168c0dSopenharmony_ci+  }
1567be168c0dSopenharmony_ci+}
1568be168c0dSopenharmony_ci+
1569be168c0dSopenharmony_ci+void MindIR_PriorBox_SetAspectRatios(PrimitivePtr *primitive, const std::vector<float> &aspect_ratios) {
1570be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1571be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1572be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1573be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1574be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1575be168c0dSopenharmony_ci+      auto ops_offset = schema::CreatePriorBox(fbb, fbb.CreateVector(value->min_sizes()->data(), value->min_sizes()->size()), fbb.CreateVector(value->max_sizes()->data(), value->max_sizes()->size()), fbb.CreateVector(aspect_ratios.data(), aspect_ratios.size()), fbb.CreateVector(value->variances()->data(), value->variances()->size()), value->image_size_w(), value->image_size_h(), value->step_w(), value->step_h(), value->clip(), value->flip(), value->offset());
1576be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_PRIOR_BOX), ops_offset.o);
1577be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1578be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1579be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1580be168c0dSopenharmony_ci+      free(*primitive);
1581be168c0dSopenharmony_ci+      *primitive = ret_value;
1582be168c0dSopenharmony_ci+    }
1583be168c0dSopenharmony_ci+  }
1584be168c0dSopenharmony_ci+}
1585be168c0dSopenharmony_ci+
1586be168c0dSopenharmony_ci+std::vector<float> MindIR_PriorBox_GetVariances(ConstPrimitivePtr primitive) {
1587be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1588be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1589be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1590be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1591be168c0dSopenharmony_ci+      std::vector<float> result;
1592be168c0dSopenharmony_ci+      auto src = value->variances();
1593be168c0dSopenharmony_ci+      if (src == nullptr) {
1594be168c0dSopenharmony_ci+        return {};
1595be168c0dSopenharmony_ci+      }
1596be168c0dSopenharmony_ci+      result.resize(src->size());
1597be168c0dSopenharmony_ci+      std::transform(src->begin(), src->end(), result.begin(), [](float item) { return item; });
1598be168c0dSopenharmony_ci+      return result;
1599be168c0dSopenharmony_ci+    } else {
1600be168c0dSopenharmony_ci+      return {};
1601be168c0dSopenharmony_ci+    }
1602be168c0dSopenharmony_ci+  } else {
1603be168c0dSopenharmony_ci+    return {};
1604be168c0dSopenharmony_ci+  }
1605be168c0dSopenharmony_ci+}
1606be168c0dSopenharmony_ci+
1607be168c0dSopenharmony_ci+void MindIR_PriorBox_SetVariances(PrimitivePtr *primitive, const std::vector<float> &variances) {
1608be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1609be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1610be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1611be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1612be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1613be168c0dSopenharmony_ci+      auto ops_offset = schema::CreatePriorBox(fbb, fbb.CreateVector(value->min_sizes()->data(), value->min_sizes()->size()), fbb.CreateVector(value->max_sizes()->data(), value->max_sizes()->size()), fbb.CreateVector(value->aspect_ratios()->data(), value->aspect_ratios()->size()), fbb.CreateVector(variances.data(), variances.size()), value->image_size_w(), value->image_size_h(), value->step_w(), value->step_h(), value->clip(), value->flip(), value->offset());
1614be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_PRIOR_BOX), ops_offset.o);
1615be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1616be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1617be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1618be168c0dSopenharmony_ci+      free(*primitive);
1619be168c0dSopenharmony_ci+      *primitive = ret_value;
1620be168c0dSopenharmony_ci+    }
1621be168c0dSopenharmony_ci+  }
1622be168c0dSopenharmony_ci+}
1623be168c0dSopenharmony_ci+
1624be168c0dSopenharmony_ci+int64_t MindIR_PriorBox_GetImageSizeW(ConstPrimitivePtr primitive) {
1625be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1626be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1627be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1628be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1629be168c0dSopenharmony_ci+      return value->image_size_w();
1630be168c0dSopenharmony_ci+    } else {
1631be168c0dSopenharmony_ci+      return 0;
1632be168c0dSopenharmony_ci+    }
1633be168c0dSopenharmony_ci+  } else {
1634be168c0dSopenharmony_ci+    return 0;
1635be168c0dSopenharmony_ci+  }
1636be168c0dSopenharmony_ci+}
1637be168c0dSopenharmony_ci+
1638be168c0dSopenharmony_ci+void MindIR_PriorBox_SetImageSizeW(PrimitivePtr *primitive, int64_t image_size_w) {
1639be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1640be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1641be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1642be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1643be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1644be168c0dSopenharmony_ci+      auto ops_offset = schema::CreatePriorBox(fbb, fbb.CreateVector(value->min_sizes()->data(), value->min_sizes()->size()), fbb.CreateVector(value->max_sizes()->data(), value->max_sizes()->size()), fbb.CreateVector(value->aspect_ratios()->data(), value->aspect_ratios()->size()), fbb.CreateVector(value->variances()->data(), value->variances()->size()), image_size_w, value->image_size_h(), value->step_w(), value->step_h(), value->clip(), value->flip(), value->offset());
1645be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_PRIOR_BOX), ops_offset.o);
1646be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1647be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1648be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1649be168c0dSopenharmony_ci+      free(*primitive);
1650be168c0dSopenharmony_ci+      *primitive = ret_value;
1651be168c0dSopenharmony_ci+    }
1652be168c0dSopenharmony_ci+  }
1653be168c0dSopenharmony_ci+}
1654be168c0dSopenharmony_ci+
1655be168c0dSopenharmony_ci+int64_t MindIR_PriorBox_GetImageSizeH(ConstPrimitivePtr primitive) {
1656be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1657be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1658be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1659be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1660be168c0dSopenharmony_ci+      return value->image_size_h();
1661be168c0dSopenharmony_ci+    } else {
1662be168c0dSopenharmony_ci+      return 0;
1663be168c0dSopenharmony_ci+    }
1664be168c0dSopenharmony_ci+  } else {
1665be168c0dSopenharmony_ci+    return 0;
1666be168c0dSopenharmony_ci+  }
1667be168c0dSopenharmony_ci+}
1668be168c0dSopenharmony_ci+
1669be168c0dSopenharmony_ci+void MindIR_PriorBox_SetImageSizeH(PrimitivePtr *primitive, int64_t image_size_h) {
1670be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1671be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1672be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1673be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1674be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1675be168c0dSopenharmony_ci+      auto ops_offset = schema::CreatePriorBox(fbb, fbb.CreateVector(value->min_sizes()->data(), value->min_sizes()->size()), fbb.CreateVector(value->max_sizes()->data(), value->max_sizes()->size()), fbb.CreateVector(value->aspect_ratios()->data(), value->aspect_ratios()->size()), fbb.CreateVector(value->variances()->data(), value->variances()->size()), value->image_size_w(), image_size_h, value->step_w(), value->step_h(), value->clip(), value->flip(), value->offset());
1676be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_PRIOR_BOX), ops_offset.o);
1677be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1678be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1679be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1680be168c0dSopenharmony_ci+      free(*primitive);
1681be168c0dSopenharmony_ci+      *primitive = ret_value;
1682be168c0dSopenharmony_ci+    }
1683be168c0dSopenharmony_ci+  }
1684be168c0dSopenharmony_ci+}
1685be168c0dSopenharmony_ci+
1686be168c0dSopenharmony_ci+float MindIR_PriorBox_GetStepW(ConstPrimitivePtr primitive) {
1687be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1688be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1689be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1690be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1691be168c0dSopenharmony_ci+      return value->step_w();
1692be168c0dSopenharmony_ci+    } else {
1693be168c0dSopenharmony_ci+      return .0;
1694be168c0dSopenharmony_ci+    }
1695be168c0dSopenharmony_ci+  } else {
1696be168c0dSopenharmony_ci+    return .0;
1697be168c0dSopenharmony_ci+  }
1698be168c0dSopenharmony_ci+}
1699be168c0dSopenharmony_ci+
1700be168c0dSopenharmony_ci+void MindIR_PriorBox_SetStepW(PrimitivePtr *primitive, float step_w) {
1701be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1702be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1703be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1704be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1705be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1706be168c0dSopenharmony_ci+      auto ops_offset = schema::CreatePriorBox(fbb, fbb.CreateVector(value->min_sizes()->data(), value->min_sizes()->size()), fbb.CreateVector(value->max_sizes()->data(), value->max_sizes()->size()), fbb.CreateVector(value->aspect_ratios()->data(), value->aspect_ratios()->size()), fbb.CreateVector(value->variances()->data(), value->variances()->size()), value->image_size_w(), value->image_size_h(), step_w, value->step_h(), value->clip(), value->flip(), value->offset());
1707be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_PRIOR_BOX), ops_offset.o);
1708be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1709be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1710be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1711be168c0dSopenharmony_ci+      free(*primitive);
1712be168c0dSopenharmony_ci+      *primitive = ret_value;
1713be168c0dSopenharmony_ci+    }
1714be168c0dSopenharmony_ci+  }
1715be168c0dSopenharmony_ci+}
1716be168c0dSopenharmony_ci+
1717be168c0dSopenharmony_ci+float MindIR_PriorBox_GetStepH(ConstPrimitivePtr primitive) {
1718be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1719be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1720be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1721be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1722be168c0dSopenharmony_ci+      return value->step_h();
1723be168c0dSopenharmony_ci+    } else {
1724be168c0dSopenharmony_ci+      return .0;
1725be168c0dSopenharmony_ci+    }
1726be168c0dSopenharmony_ci+  } else {
1727be168c0dSopenharmony_ci+    return .0;
1728be168c0dSopenharmony_ci+  }
1729be168c0dSopenharmony_ci+}
1730be168c0dSopenharmony_ci+
1731be168c0dSopenharmony_ci+void MindIR_PriorBox_SetStepH(PrimitivePtr *primitive, float step_h) {
1732be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1733be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1734be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1735be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1736be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1737be168c0dSopenharmony_ci+      auto ops_offset = schema::CreatePriorBox(fbb, fbb.CreateVector(value->min_sizes()->data(), value->min_sizes()->size()), fbb.CreateVector(value->max_sizes()->data(), value->max_sizes()->size()), fbb.CreateVector(value->aspect_ratios()->data(), value->aspect_ratios()->size()), fbb.CreateVector(value->variances()->data(), value->variances()->size()), value->image_size_w(), value->image_size_h(), value->step_w(), step_h, value->clip(), value->flip(), value->offset());
1738be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_PRIOR_BOX), ops_offset.o);
1739be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1740be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1741be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1742be168c0dSopenharmony_ci+      free(*primitive);
1743be168c0dSopenharmony_ci+      *primitive = ret_value;
1744be168c0dSopenharmony_ci+    }
1745be168c0dSopenharmony_ci+  }
1746be168c0dSopenharmony_ci+}
1747be168c0dSopenharmony_ci+
1748be168c0dSopenharmony_ci+bool MindIR_PriorBox_GetClip(ConstPrimitivePtr primitive) {
1749be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1750be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1751be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1752be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1753be168c0dSopenharmony_ci+      return value->clip();
1754be168c0dSopenharmony_ci+    } else {
1755be168c0dSopenharmony_ci+      return false;
1756be168c0dSopenharmony_ci+    }
1757be168c0dSopenharmony_ci+  } else {
1758be168c0dSopenharmony_ci+    return false;
1759be168c0dSopenharmony_ci+  }
1760be168c0dSopenharmony_ci+}
1761be168c0dSopenharmony_ci+
1762be168c0dSopenharmony_ci+void MindIR_PriorBox_SetClip(PrimitivePtr *primitive, bool clip) {
1763be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1764be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1765be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1766be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1767be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1768be168c0dSopenharmony_ci+      auto ops_offset = schema::CreatePriorBox(fbb, fbb.CreateVector(value->min_sizes()->data(), value->min_sizes()->size()), fbb.CreateVector(value->max_sizes()->data(), value->max_sizes()->size()), fbb.CreateVector(value->aspect_ratios()->data(), value->aspect_ratios()->size()), fbb.CreateVector(value->variances()->data(), value->variances()->size()), value->image_size_w(), value->image_size_h(), value->step_w(), value->step_h(), clip, value->flip(), value->offset());
1769be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_PRIOR_BOX), ops_offset.o);
1770be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1771be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1772be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1773be168c0dSopenharmony_ci+      free(*primitive);
1774be168c0dSopenharmony_ci+      *primitive = ret_value;
1775be168c0dSopenharmony_ci+    }
1776be168c0dSopenharmony_ci+  }
1777be168c0dSopenharmony_ci+}
1778be168c0dSopenharmony_ci+
1779be168c0dSopenharmony_ci+bool MindIR_PriorBox_GetFlip(ConstPrimitivePtr primitive) {
1780be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1781be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1782be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1783be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1784be168c0dSopenharmony_ci+      return value->flip();
1785be168c0dSopenharmony_ci+    } else {
1786be168c0dSopenharmony_ci+      return false;
1787be168c0dSopenharmony_ci+    }
1788be168c0dSopenharmony_ci+  } else {
1789be168c0dSopenharmony_ci+    return false;
1790be168c0dSopenharmony_ci+  }
1791be168c0dSopenharmony_ci+}
1792be168c0dSopenharmony_ci+
1793be168c0dSopenharmony_ci+void MindIR_PriorBox_SetFlip(PrimitivePtr *primitive, bool flip) {
1794be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1795be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1796be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1797be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1798be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1799be168c0dSopenharmony_ci+      auto ops_offset = schema::CreatePriorBox(fbb, fbb.CreateVector(value->min_sizes()->data(), value->min_sizes()->size()), fbb.CreateVector(value->max_sizes()->data(), value->max_sizes()->size()), fbb.CreateVector(value->aspect_ratios()->data(), value->aspect_ratios()->size()), fbb.CreateVector(value->variances()->data(), value->variances()->size()), value->image_size_w(), value->image_size_h(), value->step_w(), value->step_h(), value->clip(), flip, value->offset());
1800be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_PRIOR_BOX), ops_offset.o);
1801be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1802be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1803be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1804be168c0dSopenharmony_ci+      free(*primitive);
1805be168c0dSopenharmony_ci+      *primitive = ret_value;
1806be168c0dSopenharmony_ci+    }
1807be168c0dSopenharmony_ci+  }
1808be168c0dSopenharmony_ci+}
1809be168c0dSopenharmony_ci+
1810be168c0dSopenharmony_ci+float MindIR_PriorBox_GetOffset(ConstPrimitivePtr primitive) {
1811be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1812be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1813be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1814be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1815be168c0dSopenharmony_ci+      return value->offset();
1816be168c0dSopenharmony_ci+    } else {
1817be168c0dSopenharmony_ci+      return .0;
1818be168c0dSopenharmony_ci+    }
1819be168c0dSopenharmony_ci+  } else {
1820be168c0dSopenharmony_ci+    return .0;
1821be168c0dSopenharmony_ci+  }
1822be168c0dSopenharmony_ci+}
1823be168c0dSopenharmony_ci+
1824be168c0dSopenharmony_ci+void MindIR_PriorBox_SetOffset(PrimitivePtr *primitive, float offset) {
1825be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1826be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1827be168c0dSopenharmony_ci+    auto value = prim->value_as_PriorBox();
1828be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1829be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1830be168c0dSopenharmony_ci+      auto ops_offset = schema::CreatePriorBox(fbb, fbb.CreateVector(value->min_sizes()->data(), value->min_sizes()->size()), fbb.CreateVector(value->max_sizes()->data(), value->max_sizes()->size()), fbb.CreateVector(value->aspect_ratios()->data(), value->aspect_ratios()->size()), fbb.CreateVector(value->variances()->data(), value->variances()->size()), value->image_size_w(), value->image_size_h(), value->step_w(), value->step_h(), value->clip(), value->flip(), offset);
1831be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_PRIOR_BOX), ops_offset.o);
1832be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1833be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1834be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1835be168c0dSopenharmony_ci+      free(*primitive);
1836be168c0dSopenharmony_ci+      *primitive = ret_value;
1837be168c0dSopenharmony_ci+    }
1838be168c0dSopenharmony_ci+  }
1839be168c0dSopenharmony_ci+}
1840be168c0dSopenharmony_ci+
1841be168c0dSopenharmony_ci+// ********** ReverseSequence **********
1842be168c0dSopenharmony_ci+PrimitivePtr MindIR_ReverseSequence_CreatePrimitive(int64_t seq_dim, int64_t batch_dim) {
1843be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
1844be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateReverseSequence(fbb, seq_dim, batch_dim);
1845be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_REVERSE_SEQUENCE), ops_offset.o);
1846be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
1847be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1848be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1849be168c0dSopenharmony_ci+  return ret_value;
1850be168c0dSopenharmony_ci+}
1851be168c0dSopenharmony_ci+
1852be168c0dSopenharmony_ci+int64_t MindIR_ReverseSequence_GetSeqDim(ConstPrimitivePtr primitive) {
1853be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1854be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1855be168c0dSopenharmony_ci+    auto value = prim->value_as_ReverseSequence();
1856be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1857be168c0dSopenharmony_ci+      return value->seq_dim();
1858be168c0dSopenharmony_ci+    } else {
1859be168c0dSopenharmony_ci+      return 0;
1860be168c0dSopenharmony_ci+    }
1861be168c0dSopenharmony_ci+  } else {
1862be168c0dSopenharmony_ci+    return 0;
1863be168c0dSopenharmony_ci+  }
1864be168c0dSopenharmony_ci+}
1865be168c0dSopenharmony_ci+
1866be168c0dSopenharmony_ci+void MindIR_ReverseSequence_SetSeqDim(PrimitivePtr *primitive, int64_t seq_dim) {
1867be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1868be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1869be168c0dSopenharmony_ci+    auto value = prim->value_as_ReverseSequence();
1870be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1871be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1872be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateReverseSequence(fbb, seq_dim, value->batch_dim());
1873be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_REVERSE_SEQUENCE), ops_offset.o);
1874be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1875be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1876be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1877be168c0dSopenharmony_ci+      free(*primitive);
1878be168c0dSopenharmony_ci+      *primitive = ret_value;
1879be168c0dSopenharmony_ci+    }
1880be168c0dSopenharmony_ci+  }
1881be168c0dSopenharmony_ci+}
1882be168c0dSopenharmony_ci+
1883be168c0dSopenharmony_ci+int64_t MindIR_ReverseSequence_GetBatchDim(ConstPrimitivePtr primitive) {
1884be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1885be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1886be168c0dSopenharmony_ci+    auto value = prim->value_as_ReverseSequence();
1887be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1888be168c0dSopenharmony_ci+      return value->batch_dim();
1889be168c0dSopenharmony_ci+    } else {
1890be168c0dSopenharmony_ci+      return 0;
1891be168c0dSopenharmony_ci+    }
1892be168c0dSopenharmony_ci+  } else {
1893be168c0dSopenharmony_ci+    return 0;
1894be168c0dSopenharmony_ci+  }
1895be168c0dSopenharmony_ci+}
1896be168c0dSopenharmony_ci+
1897be168c0dSopenharmony_ci+void MindIR_ReverseSequence_SetBatchDim(PrimitivePtr *primitive, int64_t batch_dim) {
1898be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1899be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1900be168c0dSopenharmony_ci+    auto value = prim->value_as_ReverseSequence();
1901be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1902be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1903be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateReverseSequence(fbb, value->seq_dim(), batch_dim);
1904be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_REVERSE_SEQUENCE), ops_offset.o);
1905be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1906be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1907be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1908be168c0dSopenharmony_ci+      free(*primitive);
1909be168c0dSopenharmony_ci+      *primitive = ret_value;
1910be168c0dSopenharmony_ci+    }
1911be168c0dSopenharmony_ci+  }
1912be168c0dSopenharmony_ci+}
1913be168c0dSopenharmony_ci+
1914be168c0dSopenharmony_ci+// ********** ReverseV2 **********
1915be168c0dSopenharmony_ci+PrimitivePtr MindIR_ReverseV2_CreatePrimitive(const std::vector<int64_t> &axis) {
1916be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
1917be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateReverseV2(fbb, fbb.CreateVector(axis.data(), axis.size()));
1918be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_REVERSE_V2), ops_offset.o);
1919be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
1920be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1921be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1922be168c0dSopenharmony_ci+  return ret_value;
1923be168c0dSopenharmony_ci+}
1924be168c0dSopenharmony_ci+
1925be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_ReverseV2_GetAxis(ConstPrimitivePtr primitive) {
1926be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1927be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1928be168c0dSopenharmony_ci+    auto value = prim->value_as_ReverseV2();
1929be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1930be168c0dSopenharmony_ci+      std::vector<int64_t> result;
1931be168c0dSopenharmony_ci+      auto src = value->axis();
1932be168c0dSopenharmony_ci+      if (src == nullptr) {
1933be168c0dSopenharmony_ci+        return {};
1934be168c0dSopenharmony_ci+      }
1935be168c0dSopenharmony_ci+      result.resize(src->size());
1936be168c0dSopenharmony_ci+      std::transform(src->begin(), src->end(), result.begin(), [](int64_t item) { return item; });
1937be168c0dSopenharmony_ci+      return result;
1938be168c0dSopenharmony_ci+    } else {
1939be168c0dSopenharmony_ci+      return {};
1940be168c0dSopenharmony_ci+    }
1941be168c0dSopenharmony_ci+  } else {
1942be168c0dSopenharmony_ci+    return {};
1943be168c0dSopenharmony_ci+  }
1944be168c0dSopenharmony_ci+}
1945be168c0dSopenharmony_ci+
1946be168c0dSopenharmony_ci+void MindIR_ReverseV2_SetAxis(PrimitivePtr *primitive, const std::vector<int64_t> &axis) {
1947be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1948be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1949be168c0dSopenharmony_ci+    auto value = prim->value_as_ReverseV2();
1950be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1951be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1952be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateReverseV2(fbb, fbb.CreateVector(axis.data(), axis.size()));
1953be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_REVERSE_V2), ops_offset.o);
1954be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1955be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1956be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1957be168c0dSopenharmony_ci+      free(*primitive);
1958be168c0dSopenharmony_ci+      *primitive = ret_value;
1959be168c0dSopenharmony_ci+    }
1960be168c0dSopenharmony_ci+  }
1961be168c0dSopenharmony_ci+}
1962be168c0dSopenharmony_ci+
1963be168c0dSopenharmony_ci+// ********** Rfft **********
1964be168c0dSopenharmony_ci+PrimitivePtr MindIR_Rfft_CreatePrimitive(int64_t fft_length) {
1965be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
1966be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateRfft(fbb, fft_length);
1967be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_RFFT), ops_offset.o);
1968be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
1969be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1970be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1971be168c0dSopenharmony_ci+  return ret_value;
1972be168c0dSopenharmony_ci+}
1973be168c0dSopenharmony_ci+
1974be168c0dSopenharmony_ci+int64_t MindIR_Rfft_GetFftLength(ConstPrimitivePtr primitive) {
1975be168c0dSopenharmony_ci+  if (primitive != nullptr) {
1976be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
1977be168c0dSopenharmony_ci+    auto value = prim->value_as_Rfft();
1978be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1979be168c0dSopenharmony_ci+      return value->fft_length();
1980be168c0dSopenharmony_ci+    } else {
1981be168c0dSopenharmony_ci+      return 0;
1982be168c0dSopenharmony_ci+    }
1983be168c0dSopenharmony_ci+  } else {
1984be168c0dSopenharmony_ci+    return 0;
1985be168c0dSopenharmony_ci+  }
1986be168c0dSopenharmony_ci+}
1987be168c0dSopenharmony_ci+
1988be168c0dSopenharmony_ci+void MindIR_Rfft_SetFftLength(PrimitivePtr *primitive, int64_t fft_length) {
1989be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
1990be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
1991be168c0dSopenharmony_ci+    auto value = prim->value_as_Rfft();
1992be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
1993be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
1994be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateRfft(fbb, fft_length);
1995be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_RFFT), ops_offset.o);
1996be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
1997be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
1998be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
1999be168c0dSopenharmony_ci+      free(*primitive);
2000be168c0dSopenharmony_ci+      *primitive = ret_value;
2001be168c0dSopenharmony_ci+    }
2002be168c0dSopenharmony_ci+  }
2003be168c0dSopenharmony_ci+}
2004be168c0dSopenharmony_ci+
2005be168c0dSopenharmony_ci+// ********** ROIPooling **********
2006be168c0dSopenharmony_ci+PrimitivePtr MindIR_ROIPooling_CreatePrimitive(int64_t pooled_h, int64_t pooled_w, float scale) {
2007be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2008be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateROIPooling(fbb, pooled_h, pooled_w, scale);
2009be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_R_O_I_POOLING), ops_offset.o);
2010be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2011be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2012be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2013be168c0dSopenharmony_ci+  return ret_value;
2014be168c0dSopenharmony_ci+}
2015be168c0dSopenharmony_ci+
2016be168c0dSopenharmony_ci+int64_t MindIR_ROIPooling_GetPooledH(ConstPrimitivePtr primitive) {
2017be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2018be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2019be168c0dSopenharmony_ci+    auto value = prim->value_as_ROIPooling();
2020be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2021be168c0dSopenharmony_ci+      return value->pooled_h();
2022be168c0dSopenharmony_ci+    } else {
2023be168c0dSopenharmony_ci+      return 0;
2024be168c0dSopenharmony_ci+    }
2025be168c0dSopenharmony_ci+  } else {
2026be168c0dSopenharmony_ci+    return 0;
2027be168c0dSopenharmony_ci+  }
2028be168c0dSopenharmony_ci+}
2029be168c0dSopenharmony_ci+
2030be168c0dSopenharmony_ci+void MindIR_ROIPooling_SetPooledH(PrimitivePtr *primitive, int64_t pooled_h) {
2031be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2032be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2033be168c0dSopenharmony_ci+    auto value = prim->value_as_ROIPooling();
2034be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2035be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2036be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateROIPooling(fbb, pooled_h, value->pooled_w(), value->scale());
2037be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_R_O_I_POOLING), ops_offset.o);
2038be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2039be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2040be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2041be168c0dSopenharmony_ci+      free(*primitive);
2042be168c0dSopenharmony_ci+      *primitive = ret_value;
2043be168c0dSopenharmony_ci+    }
2044be168c0dSopenharmony_ci+  }
2045be168c0dSopenharmony_ci+}
2046be168c0dSopenharmony_ci+
2047be168c0dSopenharmony_ci+int64_t MindIR_ROIPooling_GetPooledW(ConstPrimitivePtr primitive) {
2048be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2049be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2050be168c0dSopenharmony_ci+    auto value = prim->value_as_ROIPooling();
2051be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2052be168c0dSopenharmony_ci+      return value->pooled_w();
2053be168c0dSopenharmony_ci+    } else {
2054be168c0dSopenharmony_ci+      return 0;
2055be168c0dSopenharmony_ci+    }
2056be168c0dSopenharmony_ci+  } else {
2057be168c0dSopenharmony_ci+    return 0;
2058be168c0dSopenharmony_ci+  }
2059be168c0dSopenharmony_ci+}
2060be168c0dSopenharmony_ci+
2061be168c0dSopenharmony_ci+void MindIR_ROIPooling_SetPooledW(PrimitivePtr *primitive, int64_t pooled_w) {
2062be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2063be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2064be168c0dSopenharmony_ci+    auto value = prim->value_as_ROIPooling();
2065be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2066be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2067be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateROIPooling(fbb, value->pooled_h(), pooled_w, value->scale());
2068be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_R_O_I_POOLING), ops_offset.o);
2069be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2070be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2071be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2072be168c0dSopenharmony_ci+      free(*primitive);
2073be168c0dSopenharmony_ci+      *primitive = ret_value;
2074be168c0dSopenharmony_ci+    }
2075be168c0dSopenharmony_ci+  }
2076be168c0dSopenharmony_ci+}
2077be168c0dSopenharmony_ci+
2078be168c0dSopenharmony_ci+float MindIR_ROIPooling_GetScale(ConstPrimitivePtr primitive) {
2079be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2080be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2081be168c0dSopenharmony_ci+    auto value = prim->value_as_ROIPooling();
2082be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2083be168c0dSopenharmony_ci+      return value->scale();
2084be168c0dSopenharmony_ci+    } else {
2085be168c0dSopenharmony_ci+      return .0;
2086be168c0dSopenharmony_ci+    }
2087be168c0dSopenharmony_ci+  } else {
2088be168c0dSopenharmony_ci+    return .0;
2089be168c0dSopenharmony_ci+  }
2090be168c0dSopenharmony_ci+}
2091be168c0dSopenharmony_ci+
2092be168c0dSopenharmony_ci+void MindIR_ROIPooling_SetScale(PrimitivePtr *primitive, float scale) {
2093be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2094be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2095be168c0dSopenharmony_ci+    auto value = prim->value_as_ROIPooling();
2096be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2097be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2098be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateROIPooling(fbb, value->pooled_h(), value->pooled_w(), scale);
2099be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_R_O_I_POOLING), ops_offset.o);
2100be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2101be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2102be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2103be168c0dSopenharmony_ci+      free(*primitive);
2104be168c0dSopenharmony_ci+      *primitive = ret_value;
2105be168c0dSopenharmony_ci+    }
2106be168c0dSopenharmony_ci+  }
2107be168c0dSopenharmony_ci+}
2108be168c0dSopenharmony_ci+
2109be168c0dSopenharmony_ci+// ********** SkipGram **********
2110be168c0dSopenharmony_ci+PrimitivePtr MindIR_SkipGram_CreatePrimitive(bool include_all_grams, int64_t max_skip_size, int64_t ngram_size) {
2111be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2112be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateSkipGram(fbb, include_all_grams, max_skip_size, ngram_size);
2113be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SKIP_GRAM), ops_offset.o);
2114be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2115be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2116be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2117be168c0dSopenharmony_ci+  return ret_value;
2118be168c0dSopenharmony_ci+}
2119be168c0dSopenharmony_ci+
2120be168c0dSopenharmony_ci+bool MindIR_SkipGram_GetIncludeAllGrams(ConstPrimitivePtr primitive) {
2121be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2122be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2123be168c0dSopenharmony_ci+    auto value = prim->value_as_SkipGram();
2124be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2125be168c0dSopenharmony_ci+      return value->include_all_grams();
2126be168c0dSopenharmony_ci+    } else {
2127be168c0dSopenharmony_ci+      return false;
2128be168c0dSopenharmony_ci+    }
2129be168c0dSopenharmony_ci+  } else {
2130be168c0dSopenharmony_ci+    return false;
2131be168c0dSopenharmony_ci+  }
2132be168c0dSopenharmony_ci+}
2133be168c0dSopenharmony_ci+
2134be168c0dSopenharmony_ci+void MindIR_SkipGram_SetIncludeAllGrams(PrimitivePtr *primitive, bool include_all_grams) {
2135be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2136be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2137be168c0dSopenharmony_ci+    auto value = prim->value_as_SkipGram();
2138be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2139be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2140be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateSkipGram(fbb, include_all_grams, value->max_skip_size(), value->ngram_size());
2141be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SKIP_GRAM), ops_offset.o);
2142be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2143be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2144be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2145be168c0dSopenharmony_ci+      free(*primitive);
2146be168c0dSopenharmony_ci+      *primitive = ret_value;
2147be168c0dSopenharmony_ci+    }
2148be168c0dSopenharmony_ci+  }
2149be168c0dSopenharmony_ci+}
2150be168c0dSopenharmony_ci+
2151be168c0dSopenharmony_ci+int64_t MindIR_SkipGram_GetMaxSkipSize(ConstPrimitivePtr primitive) {
2152be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2153be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2154be168c0dSopenharmony_ci+    auto value = prim->value_as_SkipGram();
2155be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2156be168c0dSopenharmony_ci+      return value->max_skip_size();
2157be168c0dSopenharmony_ci+    } else {
2158be168c0dSopenharmony_ci+      return 0;
2159be168c0dSopenharmony_ci+    }
2160be168c0dSopenharmony_ci+  } else {
2161be168c0dSopenharmony_ci+    return 0;
2162be168c0dSopenharmony_ci+  }
2163be168c0dSopenharmony_ci+}
2164be168c0dSopenharmony_ci+
2165be168c0dSopenharmony_ci+void MindIR_SkipGram_SetMaxSkipSize(PrimitivePtr *primitive, int64_t max_skip_size) {
2166be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2167be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2168be168c0dSopenharmony_ci+    auto value = prim->value_as_SkipGram();
2169be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2170be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2171be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateSkipGram(fbb, value->include_all_grams(), max_skip_size, value->ngram_size());
2172be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SKIP_GRAM), ops_offset.o);
2173be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2174be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2175be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2176be168c0dSopenharmony_ci+      free(*primitive);
2177be168c0dSopenharmony_ci+      *primitive = ret_value;
2178be168c0dSopenharmony_ci+    }
2179be168c0dSopenharmony_ci+  }
2180be168c0dSopenharmony_ci+}
2181be168c0dSopenharmony_ci+
2182be168c0dSopenharmony_ci+int64_t MindIR_SkipGram_GetNgramSize(ConstPrimitivePtr primitive) {
2183be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2184be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2185be168c0dSopenharmony_ci+    auto value = prim->value_as_SkipGram();
2186be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2187be168c0dSopenharmony_ci+      return value->ngram_size();
2188be168c0dSopenharmony_ci+    } else {
2189be168c0dSopenharmony_ci+      return 0;
2190be168c0dSopenharmony_ci+    }
2191be168c0dSopenharmony_ci+  } else {
2192be168c0dSopenharmony_ci+    return 0;
2193be168c0dSopenharmony_ci+  }
2194be168c0dSopenharmony_ci+}
2195be168c0dSopenharmony_ci+
2196be168c0dSopenharmony_ci+void MindIR_SkipGram_SetNgramSize(PrimitivePtr *primitive, int64_t ngram_size) {
2197be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2198be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2199be168c0dSopenharmony_ci+    auto value = prim->value_as_SkipGram();
2200be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2201be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2202be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateSkipGram(fbb, value->include_all_grams(), value->max_skip_size(), ngram_size);
2203be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SKIP_GRAM), ops_offset.o);
2204be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2205be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2206be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2207be168c0dSopenharmony_ci+      free(*primitive);
2208be168c0dSopenharmony_ci+      *primitive = ret_value;
2209be168c0dSopenharmony_ci+    }
2210be168c0dSopenharmony_ci+  }
2211be168c0dSopenharmony_ci+}
2212be168c0dSopenharmony_ci+
2213be168c0dSopenharmony_ci+// ********** Switch **********
2214be168c0dSopenharmony_ci+PrimitivePtr MindIR_Switch_CreatePrimitive() {
2215be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2216be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateSwitch(fbb);
2217be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SWITCH), ops_offset.o);
2218be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2219be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2220be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2221be168c0dSopenharmony_ci+  return ret_value;
2222be168c0dSopenharmony_ci+}
2223be168c0dSopenharmony_ci+
2224be168c0dSopenharmony_ci+// ********** Unique **********
2225be168c0dSopenharmony_ci+PrimitivePtr MindIR_Unique_CreatePrimitive() {
2226be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2227be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateUnique(fbb);
2228be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_UNIQUE), ops_offset.o);
2229be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2230be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2231be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2232be168c0dSopenharmony_ci+  return ret_value;
2233be168c0dSopenharmony_ci+}
2234be168c0dSopenharmony_ci+
2235be168c0dSopenharmony_ci+// ********** UnsortedSegmentSum **********
2236be168c0dSopenharmony_ci+PrimitivePtr MindIR_UnsortedSegmentSum_CreatePrimitive() {
2237be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2238be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateUnsortedSegmentSum(fbb);
2239be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_UNSORTED_SEGMENT_SUM), ops_offset.o);
2240be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2241be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2242be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2243be168c0dSopenharmony_ci+  return ret_value;
2244be168c0dSopenharmony_ci+}
2245be168c0dSopenharmony_ci+
2246be168c0dSopenharmony_ci+// ********** ZerosLike **********
2247be168c0dSopenharmony_ci+PrimitivePtr MindIR_ZerosLike_CreatePrimitive() {
2248be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2249be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateZerosLike(fbb);
2250be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_ZEROS_LIKE), ops_offset.o);
2251be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2252be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2253be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2254be168c0dSopenharmony_ci+  return ret_value;
2255be168c0dSopenharmony_ci+}
2256be168c0dSopenharmony_ci+
2257be168c0dSopenharmony_ci+// ********** GRU **********
2258be168c0dSopenharmony_ci+PrimitivePtr MindIR_GRU_CreatePrimitive(bool bidirectional) {
2259be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2260be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateGRU(fbb, bidirectional);
2261be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_G_R_U), ops_offset.o);
2262be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2263be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2264be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2265be168c0dSopenharmony_ci+  return ret_value;
2266be168c0dSopenharmony_ci+}
2267be168c0dSopenharmony_ci+
2268be168c0dSopenharmony_ci+bool MindIR_GRU_GetBidirectional(ConstPrimitivePtr primitive) {
2269be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2270be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2271be168c0dSopenharmony_ci+    auto value = prim->value_as_GRU();
2272be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2273be168c0dSopenharmony_ci+      return value->bidirectional();
2274be168c0dSopenharmony_ci+    } else {
2275be168c0dSopenharmony_ci+      return false;
2276be168c0dSopenharmony_ci+    }
2277be168c0dSopenharmony_ci+  } else {
2278be168c0dSopenharmony_ci+    return false;
2279be168c0dSopenharmony_ci+  }
2280be168c0dSopenharmony_ci+}
2281be168c0dSopenharmony_ci+
2282be168c0dSopenharmony_ci+void MindIR_GRU_SetBidirectional(PrimitivePtr *primitive, bool bidirectional) {
2283be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2284be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2285be168c0dSopenharmony_ci+    auto value = prim->value_as_GRU();
2286be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2287be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2288be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGRU(fbb, bidirectional);
2289be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_G_R_U), ops_offset.o);
2290be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2291be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2292be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2293be168c0dSopenharmony_ci+      free(*primitive);
2294be168c0dSopenharmony_ci+      *primitive = ret_value;
2295be168c0dSopenharmony_ci+    }
2296be168c0dSopenharmony_ci+  }
2297be168c0dSopenharmony_ci+}
2298be168c0dSopenharmony_ci+
2299be168c0dSopenharmony_ci+// ********** NonZero **********
2300be168c0dSopenharmony_ci+PrimitivePtr MindIR_NonZero_CreatePrimitive() {
2301be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2302be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateNonZero(fbb);
2303be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_NON_ZERO), ops_offset.o);
2304be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2305be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2306be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2307be168c0dSopenharmony_ci+  return ret_value;
2308be168c0dSopenharmony_ci+}
2309be168c0dSopenharmony_ci+
2310be168c0dSopenharmony_ci+// ********** InvertPermutation **********
2311be168c0dSopenharmony_ci+PrimitivePtr MindIR_InvertPermutation_CreatePrimitive() {
2312be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2313be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateInvertPermutation(fbb);
2314be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_INVERT_PERMUTATION), ops_offset.o);
2315be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2316be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2317be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2318be168c0dSopenharmony_ci+  return ret_value;
2319be168c0dSopenharmony_ci+}
2320be168c0dSopenharmony_ci+
2321be168c0dSopenharmony_ci+// ********** Size **********
2322be168c0dSopenharmony_ci+PrimitivePtr MindIR_Size_CreatePrimitive() {
2323be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2324be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateSize(fbb);
2325be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SIZE), ops_offset.o);
2326be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2327be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2328be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2329be168c0dSopenharmony_ci+  return ret_value;
2330be168c0dSopenharmony_ci+}
2331be168c0dSopenharmony_ci+
2332be168c0dSopenharmony_ci+// ********** RandomStandardNormal **********
2333be168c0dSopenharmony_ci+PrimitivePtr MindIR_RandomStandardNormal_CreatePrimitive(int64_t seed, int64_t seed2) {
2334be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2335be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateRandomStandardNormal(fbb, seed, seed2);
2336be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_RANDOM_STANDARD_NORMAL), ops_offset.o);
2337be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2338be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2339be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2340be168c0dSopenharmony_ci+  return ret_value;
2341be168c0dSopenharmony_ci+}
2342be168c0dSopenharmony_ci+
2343be168c0dSopenharmony_ci+int64_t MindIR_RandomStandardNormal_GetSeed(ConstPrimitivePtr primitive) {
2344be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2345be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2346be168c0dSopenharmony_ci+    auto value = prim->value_as_RandomStandardNormal();
2347be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2348be168c0dSopenharmony_ci+      return value->seed();
2349be168c0dSopenharmony_ci+    } else {
2350be168c0dSopenharmony_ci+      return 0;
2351be168c0dSopenharmony_ci+    }
2352be168c0dSopenharmony_ci+  } else {
2353be168c0dSopenharmony_ci+    return 0;
2354be168c0dSopenharmony_ci+  }
2355be168c0dSopenharmony_ci+}
2356be168c0dSopenharmony_ci+
2357be168c0dSopenharmony_ci+void MindIR_RandomStandardNormal_SetSeed(PrimitivePtr *primitive, int64_t seed) {
2358be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2359be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2360be168c0dSopenharmony_ci+    auto value = prim->value_as_RandomStandardNormal();
2361be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2362be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2363be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateRandomStandardNormal(fbb, seed, value->seed2());
2364be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_RANDOM_STANDARD_NORMAL), ops_offset.o);
2365be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2366be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2367be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2368be168c0dSopenharmony_ci+      free(*primitive);
2369be168c0dSopenharmony_ci+      *primitive = ret_value;
2370be168c0dSopenharmony_ci+    }
2371be168c0dSopenharmony_ci+  }
2372be168c0dSopenharmony_ci+}
2373be168c0dSopenharmony_ci+int64_t MindIR_RandomStandardNormal_GetSeed2(ConstPrimitivePtr primitive) {
2374be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2375be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2376be168c0dSopenharmony_ci+    auto value = prim->value_as_RandomStandardNormal();
2377be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2378be168c0dSopenharmony_ci+      return value->seed2();
2379be168c0dSopenharmony_ci+    } else {
2380be168c0dSopenharmony_ci+      return 0;
2381be168c0dSopenharmony_ci+    }
2382be168c0dSopenharmony_ci+  } else {
2383be168c0dSopenharmony_ci+    return 0;
2384be168c0dSopenharmony_ci+  }
2385be168c0dSopenharmony_ci+}
2386be168c0dSopenharmony_ci+
2387be168c0dSopenharmony_ci+void MindIR_RandomStandardNormal_SetSeed2(PrimitivePtr *primitive, int64_t seed2) {
2388be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2389be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2390be168c0dSopenharmony_ci+    auto value = prim->value_as_RandomStandardNormal();
2391be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2392be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2393be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateRandomStandardNormal(fbb, value->seed(), seed2);
2394be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_RANDOM_STANDARD_NORMAL), ops_offset.o);
2395be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2396be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2397be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2398be168c0dSopenharmony_ci+      free(*primitive);
2399be168c0dSopenharmony_ci+      *primitive = ret_value;
2400be168c0dSopenharmony_ci+    }
2401be168c0dSopenharmony_ci+  }
2402be168c0dSopenharmony_ci+}
2403be168c0dSopenharmony_ci+
2404be168c0dSopenharmony_ci+// ********** CropAndResize **********
2405be168c0dSopenharmony_ci+PrimitivePtr MindIR_CropAndResize_CreatePrimitive(ResizeMethod method, float extrapolation_value) {
2406be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2407be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateCropAndResize(fbb, static_cast<schema::ResizeMethod>(method), extrapolation_value);
2408be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_CROP_AND_RESIZE), ops_offset.o);
2409be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2410be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2411be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2412be168c0dSopenharmony_ci+  return ret_value;
2413be168c0dSopenharmony_ci+}
2414be168c0dSopenharmony_ci+
2415be168c0dSopenharmony_ci+ResizeMethod MindIR_CropAndResize_GetMethod(ConstPrimitivePtr primitive) {
2416be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2417be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2418be168c0dSopenharmony_ci+    auto value = prim->value_as_CropAndResize();
2419be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2420be168c0dSopenharmony_ci+      return static_cast<ResizeMethod>(value->method());
2421be168c0dSopenharmony_ci+    } else {
2422be168c0dSopenharmony_ci+      ResizeMethod en = static_cast<ResizeMethod>(0);
2423be168c0dSopenharmony_ci+      return en;
2424be168c0dSopenharmony_ci+    }
2425be168c0dSopenharmony_ci+  } else {
2426be168c0dSopenharmony_ci+    ResizeMethod en = static_cast<ResizeMethod>(0);
2427be168c0dSopenharmony_ci+    return en;
2428be168c0dSopenharmony_ci+  }
2429be168c0dSopenharmony_ci+}
2430be168c0dSopenharmony_ci+
2431be168c0dSopenharmony_ci+void MindIR_CropAndResize_SetMethod(PrimitivePtr *primitive, ResizeMethod method) {
2432be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2433be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2434be168c0dSopenharmony_ci+    auto value = prim->value_as_CropAndResize();
2435be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2436be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2437be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateCropAndResize(fbb, static_cast<schema::ResizeMethod>(method), value->extrapolation_value());
2438be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_CROP_AND_RESIZE), ops_offset.o);
2439be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2440be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2441be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2442be168c0dSopenharmony_ci+      free(*primitive);
2443be168c0dSopenharmony_ci+      *primitive = ret_value;
2444be168c0dSopenharmony_ci+    }
2445be168c0dSopenharmony_ci+  }
2446be168c0dSopenharmony_ci+}
2447be168c0dSopenharmony_ci+
2448be168c0dSopenharmony_ci+float MindIR_CropAndResize_GetExtrapolationValue(ConstPrimitivePtr primitive) {
2449be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2450be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2451be168c0dSopenharmony_ci+    auto value = prim->value_as_CropAndResize();
2452be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2453be168c0dSopenharmony_ci+      return value->extrapolation_value();
2454be168c0dSopenharmony_ci+    } else {
2455be168c0dSopenharmony_ci+      return .0;
2456be168c0dSopenharmony_ci+    }
2457be168c0dSopenharmony_ci+  } else {
2458be168c0dSopenharmony_ci+    return .0;
2459be168c0dSopenharmony_ci+  }
2460be168c0dSopenharmony_ci+}
2461be168c0dSopenharmony_ci+
2462be168c0dSopenharmony_ci+void MindIR_CropAndResize_SetExtrapolationValue(PrimitivePtr *primitive, float extrapolation_value) {
2463be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2464be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2465be168c0dSopenharmony_ci+    auto value = prim->value_as_CropAndResize();
2466be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2467be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2468be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateCropAndResize(fbb, static_cast<schema::ResizeMethod>(value->method()), extrapolation_value);
2469be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_CROP_AND_RESIZE), ops_offset.o);
2470be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2471be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2472be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2473be168c0dSopenharmony_ci+      free(*primitive);
2474be168c0dSopenharmony_ci+      *primitive = ret_value;
2475be168c0dSopenharmony_ci+    }
2476be168c0dSopenharmony_ci+  }
2477be168c0dSopenharmony_ci+}
2478be168c0dSopenharmony_ci+
2479be168c0dSopenharmony_ci+// ********** IsFinite **********
2480be168c0dSopenharmony_ci+PrimitivePtr MindIR_IsFinite_CreatePrimitive() {
2481be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2482be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateIsFinite(fbb);
2483be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_IS_FINITE), ops_offset.o);
2484be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2485be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2486be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2487be168c0dSopenharmony_ci+  return ret_value;
2488be168c0dSopenharmony_ci+}
2489be168c0dSopenharmony_ci+
2490be168c0dSopenharmony_ci+// ********** LinSpace **********
2491be168c0dSopenharmony_ci+PrimitivePtr MindIR_LinSpace_CreatePrimitive() {
2492be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2493be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateLinSpace(fbb);
2494be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_LIN_SPACE), ops_offset.o);
2495be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2496be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2497be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2498be168c0dSopenharmony_ci+  return ret_value;
2499be168c0dSopenharmony_ci+}
2500be168c0dSopenharmony_ci+
2501be168c0dSopenharmony_ci+// ********** UniformReal **********
2502be168c0dSopenharmony_ci+PrimitivePtr MindIR_UniformReal_CreatePrimitive(int64_t seed, int64_t seed2) {
2503be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2504be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateUniformReal(fbb, seed, seed2);
2505be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_UNIFORM_REAL), ops_offset.o);
2506be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2507be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2508be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2509be168c0dSopenharmony_ci+  return ret_value;
2510be168c0dSopenharmony_ci+}
2511be168c0dSopenharmony_ci+
2512be168c0dSopenharmony_ci+int64_t MindIR_UniformReal_GetSeed(ConstPrimitivePtr primitive) {
2513be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2514be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2515be168c0dSopenharmony_ci+    auto value = prim->value_as_UniformReal();
2516be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2517be168c0dSopenharmony_ci+      return value->seed();
2518be168c0dSopenharmony_ci+    } else {
2519be168c0dSopenharmony_ci+      return 0;
2520be168c0dSopenharmony_ci+    }
2521be168c0dSopenharmony_ci+  } else {
2522be168c0dSopenharmony_ci+    return 0;
2523be168c0dSopenharmony_ci+  }
2524be168c0dSopenharmony_ci+}
2525be168c0dSopenharmony_ci+
2526be168c0dSopenharmony_ci+void MindIR_UniformReal_SetSeed(PrimitivePtr *primitive, int64_t seed) {
2527be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2528be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2529be168c0dSopenharmony_ci+    auto value = prim->value_as_UniformReal();
2530be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2531be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2532be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateUniformReal(fbb, seed, value->seed2());
2533be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_UNIFORM_REAL), ops_offset.o);
2534be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2535be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2536be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2537be168c0dSopenharmony_ci+      free(*primitive);
2538be168c0dSopenharmony_ci+      *primitive = ret_value;
2539be168c0dSopenharmony_ci+    }
2540be168c0dSopenharmony_ci+  }
2541be168c0dSopenharmony_ci+}
2542be168c0dSopenharmony_ci+
2543be168c0dSopenharmony_ci+int64_t MindIR_UniformReal_GetSeed2(ConstPrimitivePtr primitive) {
2544be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2545be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2546be168c0dSopenharmony_ci+    auto value = prim->value_as_UniformReal();
2547be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2548be168c0dSopenharmony_ci+      return value->seed2();
2549be168c0dSopenharmony_ci+    } else {
2550be168c0dSopenharmony_ci+      return 0;
2551be168c0dSopenharmony_ci+    }
2552be168c0dSopenharmony_ci+  } else {
2553be168c0dSopenharmony_ci+    return 0;
2554be168c0dSopenharmony_ci+  }
2555be168c0dSopenharmony_ci+}
2556be168c0dSopenharmony_ci+
2557be168c0dSopenharmony_ci+void MindIR_UniformReal_SetSeed2(PrimitivePtr *primitive, int64_t seed2) {
2558be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2559be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2560be168c0dSopenharmony_ci+    auto value = prim->value_as_UniformReal();
2561be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2562be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2563be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateUniformReal(fbb, value->seed(), seed2);
2564be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_UNIFORM_REAL), ops_offset.o);
2565be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2566be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2567be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2568be168c0dSopenharmony_ci+      free(*primitive);
2569be168c0dSopenharmony_ci+      *primitive = ret_value;
2570be168c0dSopenharmony_ci+    }
2571be168c0dSopenharmony_ci+  }
2572be168c0dSopenharmony_ci+}
2573be168c0dSopenharmony_ci+
2574be168c0dSopenharmony_ci+// ********** Splice **********
2575be168c0dSopenharmony_ci+PrimitivePtr MindIR_Splice_CreatePrimitive(const std::vector<int64_t> &context, const std::vector<int64_t> &forward_indexes, int64_t output_dim) {
2576be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2577be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateSplice(fbb, fbb.CreateVector(context.data(), context.size()), fbb.CreateVector(forward_indexes.data(), forward_indexes.size()), output_dim);
2578be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SPLICE), ops_offset.o);
2579be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2580be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2581be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2582be168c0dSopenharmony_ci+  return ret_value;
2583be168c0dSopenharmony_ci+}
2584be168c0dSopenharmony_ci+
2585be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_Splice_GetContext(ConstPrimitivePtr primitive) {
2586be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2587be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2588be168c0dSopenharmony_ci+    auto value = prim->value_as_Splice();
2589be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2590be168c0dSopenharmony_ci+      std::vector<int64_t> result;
2591be168c0dSopenharmony_ci+      auto src = value->context();
2592be168c0dSopenharmony_ci+      if (src == nullptr) {
2593be168c0dSopenharmony_ci+        return {};
2594be168c0dSopenharmony_ci+      }
2595be168c0dSopenharmony_ci+      result.resize(src->size());
2596be168c0dSopenharmony_ci+      std::transform(src->begin(), src->end(), result.begin(), [](int64_t item) { return item; });
2597be168c0dSopenharmony_ci+      return result;
2598be168c0dSopenharmony_ci+    } else {
2599be168c0dSopenharmony_ci+      return {};
2600be168c0dSopenharmony_ci+    }
2601be168c0dSopenharmony_ci+  } else {
2602be168c0dSopenharmony_ci+    return {};
2603be168c0dSopenharmony_ci+  }
2604be168c0dSopenharmony_ci+}
2605be168c0dSopenharmony_ci+
2606be168c0dSopenharmony_ci+void MindIR_Splice_SetContext(PrimitivePtr *primitive, const std::vector<int64_t> &context) {
2607be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2608be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2609be168c0dSopenharmony_ci+    auto value = prim->value_as_Splice();
2610be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2611be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2612be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateSplice(fbb, fbb.CreateVector(context.data(), context.size()), fbb.CreateVector(value->forward_indexes()->data(), value->forward_indexes()->size()), value->output_dim());
2613be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SPLICE), ops_offset.o);
2614be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2615be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2616be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2617be168c0dSopenharmony_ci+      free(*primitive);
2618be168c0dSopenharmony_ci+      *primitive = ret_value;
2619be168c0dSopenharmony_ci+    }
2620be168c0dSopenharmony_ci+  }
2621be168c0dSopenharmony_ci+}
2622be168c0dSopenharmony_ci+
2623be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_Splice_GetForwardIndexes(ConstPrimitivePtr primitive) {
2624be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2625be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2626be168c0dSopenharmony_ci+    auto value = prim->value_as_Splice();
2627be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2628be168c0dSopenharmony_ci+      std::vector<int64_t> result;
2629be168c0dSopenharmony_ci+      auto src = value->forward_indexes();
2630be168c0dSopenharmony_ci+      if (src == nullptr) {
2631be168c0dSopenharmony_ci+        return {};
2632be168c0dSopenharmony_ci+      }
2633be168c0dSopenharmony_ci+      result.resize(src->size());
2634be168c0dSopenharmony_ci+      std::transform(src->begin(), src->end(), result.begin(), [](int64_t item) { return item; });
2635be168c0dSopenharmony_ci+      return result;
2636be168c0dSopenharmony_ci+    } else {
2637be168c0dSopenharmony_ci+      return {};
2638be168c0dSopenharmony_ci+    }
2639be168c0dSopenharmony_ci+  } else {
2640be168c0dSopenharmony_ci+    return {};
2641be168c0dSopenharmony_ci+  }
2642be168c0dSopenharmony_ci+}
2643be168c0dSopenharmony_ci+
2644be168c0dSopenharmony_ci+void MindIR_Splice_SetForwardIndexes(PrimitivePtr *primitive, const std::vector<int64_t> &forward_indexes) {
2645be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2646be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2647be168c0dSopenharmony_ci+    auto value = prim->value_as_Splice();
2648be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2649be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2650be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateSplice(fbb, fbb.CreateVector(value->context()->data(), value->context()->size()), fbb.CreateVector(forward_indexes.data(), forward_indexes.size()), value->output_dim());
2651be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SPLICE), ops_offset.o);
2652be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2653be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2654be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2655be168c0dSopenharmony_ci+      free(*primitive);
2656be168c0dSopenharmony_ci+      *primitive = ret_value;
2657be168c0dSopenharmony_ci+    }
2658be168c0dSopenharmony_ci+  }
2659be168c0dSopenharmony_ci+}
2660be168c0dSopenharmony_ci+
2661be168c0dSopenharmony_ci+int64_t MindIR_Splice_GetOutputDim(ConstPrimitivePtr primitive) {
2662be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2663be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2664be168c0dSopenharmony_ci+    auto value = prim->value_as_Splice();
2665be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2666be168c0dSopenharmony_ci+      return value->output_dim();
2667be168c0dSopenharmony_ci+    } else {
2668be168c0dSopenharmony_ci+      return 0;
2669be168c0dSopenharmony_ci+    }
2670be168c0dSopenharmony_ci+  } else {
2671be168c0dSopenharmony_ci+    return 0;
2672be168c0dSopenharmony_ci+  }
2673be168c0dSopenharmony_ci+}
2674be168c0dSopenharmony_ci+
2675be168c0dSopenharmony_ci+void MindIR_Splice_SetOutputDim(PrimitivePtr *primitive, int64_t output_dim) {
2676be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2677be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2678be168c0dSopenharmony_ci+    auto value = prim->value_as_Splice();
2679be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2680be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2681be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateSplice(fbb, fbb.CreateVector(value->context()->data(), value->context()->size()), fbb.CreateVector(value->forward_indexes()->data(), value->forward_indexes()->size()), output_dim);
2682be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SPLICE), ops_offset.o);
2683be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2684be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2685be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2686be168c0dSopenharmony_ci+      free(*primitive);
2687be168c0dSopenharmony_ci+      *primitive = ret_value;
2688be168c0dSopenharmony_ci+    }
2689be168c0dSopenharmony_ci+  }
2690be168c0dSopenharmony_ci+}
2691be168c0dSopenharmony_ci+
2692be168c0dSopenharmony_ci+// ********** Call **********
2693be168c0dSopenharmony_ci+PrimitivePtr MindIR_Call_CreatePrimitive(bool is_tail_call) {
2694be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2695be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateCall(fbb, is_tail_call);
2696be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_CALL), ops_offset.o);
2697be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2698be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2699be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2700be168c0dSopenharmony_ci+  return ret_value;
2701be168c0dSopenharmony_ci+}
2702be168c0dSopenharmony_ci+
2703be168c0dSopenharmony_ci+bool MindIR_Call_GetIsTailCall(ConstPrimitivePtr primitive) {
2704be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2705be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2706be168c0dSopenharmony_ci+    auto value = prim->value_as_Call();
2707be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2708be168c0dSopenharmony_ci+      return value->is_tail_call();
2709be168c0dSopenharmony_ci+    } else {
2710be168c0dSopenharmony_ci+      return false;
2711be168c0dSopenharmony_ci+    }
2712be168c0dSopenharmony_ci+  } else {
2713be168c0dSopenharmony_ci+    return false;
2714be168c0dSopenharmony_ci+  }
2715be168c0dSopenharmony_ci+}
2716be168c0dSopenharmony_ci+
2717be168c0dSopenharmony_ci+void MindIR_Call_SetIsTailCall(PrimitivePtr *primitive, bool is_tail_call) {
2718be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2719be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2720be168c0dSopenharmony_ci+    auto value = prim->value_as_Call();
2721be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2722be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2723be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateCall(fbb, is_tail_call);
2724be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_CALL), ops_offset.o);
2725be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2726be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2727be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2728be168c0dSopenharmony_ci+      free(*primitive);
2729be168c0dSopenharmony_ci+      *primitive = ret_value;
2730be168c0dSopenharmony_ci+    }
2731be168c0dSopenharmony_ci+  }
2732be168c0dSopenharmony_ci+}
2733be168c0dSopenharmony_ci+
2734be168c0dSopenharmony_ci+// ********** CumSum **********
2735be168c0dSopenharmony_ci+PrimitivePtr MindIR_CumSum_CreatePrimitive(bool exclusive, bool reverse) {
2736be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2737be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateCumSum(fbb, exclusive, reverse);
2738be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_CUM_SUM), ops_offset.o);
2739be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2740be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2741be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2742be168c0dSopenharmony_ci+  return ret_value;
2743be168c0dSopenharmony_ci+}
2744be168c0dSopenharmony_ci+
2745be168c0dSopenharmony_ci+bool MindIR_CumSum_GetExclusive(ConstPrimitivePtr primitive) {
2746be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2747be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2748be168c0dSopenharmony_ci+    auto value = prim->value_as_CumSum();
2749be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2750be168c0dSopenharmony_ci+      return value->exclusive();
2751be168c0dSopenharmony_ci+    } else {
2752be168c0dSopenharmony_ci+      return false;
2753be168c0dSopenharmony_ci+    }
2754be168c0dSopenharmony_ci+  } else {
2755be168c0dSopenharmony_ci+    return false;
2756be168c0dSopenharmony_ci+  }
2757be168c0dSopenharmony_ci+}
2758be168c0dSopenharmony_ci+
2759be168c0dSopenharmony_ci+void MindIR_CumSum_SetExclusive(PrimitivePtr *primitive, bool exclusive) {
2760be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2761be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2762be168c0dSopenharmony_ci+    auto value = prim->value_as_CumSum();
2763be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2764be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2765be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateCumSum(fbb, exclusive, value->reverse());
2766be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_CUM_SUM), ops_offset.o);
2767be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2768be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2769be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2770be168c0dSopenharmony_ci+      free(*primitive);
2771be168c0dSopenharmony_ci+      *primitive = ret_value;
2772be168c0dSopenharmony_ci+    }
2773be168c0dSopenharmony_ci+  }
2774be168c0dSopenharmony_ci+}
2775be168c0dSopenharmony_ci+
2776be168c0dSopenharmony_ci+bool MindIR_CumSum_GetReverse(ConstPrimitivePtr primitive) {
2777be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2778be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2779be168c0dSopenharmony_ci+    auto value = prim->value_as_CumSum();
2780be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2781be168c0dSopenharmony_ci+      return value->reverse();
2782be168c0dSopenharmony_ci+    } else {
2783be168c0dSopenharmony_ci+      return false;
2784be168c0dSopenharmony_ci+    }
2785be168c0dSopenharmony_ci+  } else {
2786be168c0dSopenharmony_ci+    return false;
2787be168c0dSopenharmony_ci+  }
2788be168c0dSopenharmony_ci+}
2789be168c0dSopenharmony_ci+
2790be168c0dSopenharmony_ci+void MindIR_CumSum_SetReverse(PrimitivePtr *primitive, bool reverse) {
2791be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2792be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2793be168c0dSopenharmony_ci+    auto value = prim->value_as_CumSum();
2794be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2795be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2796be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateCumSum(fbb, value->exclusive(), reverse);
2797be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_CUM_SUM), ops_offset.o);
2798be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2799be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2800be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2801be168c0dSopenharmony_ci+      free(*primitive);
2802be168c0dSopenharmony_ci+      *primitive = ret_value;
2803be168c0dSopenharmony_ci+    }
2804be168c0dSopenharmony_ci+  }
2805be168c0dSopenharmony_ci+}
2806be168c0dSopenharmony_ci+}  // namespace lite
2807be168c0dSopenharmony_ci+}  // namespace mindspore
2808be168c0dSopenharmony_cidiff --git a/mindspore/lite/mindir/src/mindir_2.cc b/mindspore/lite/mindir/src/mindir_2.cc
2809be168c0dSopenharmony_cinew file mode 100644
2810be168c0dSopenharmony_ciindex 00000000..5c91b7bf
2811be168c0dSopenharmony_ci--- /dev/null
2812be168c0dSopenharmony_ci+++ b/mindspore/lite/mindir/src/mindir_2.cc
2813be168c0dSopenharmony_ci@@ -0,0 +1,2152 @@
2814be168c0dSopenharmony_ci+/**
2815be168c0dSopenharmony_ci+ * Copyright 2024 Huawei Technologies Co., Ltd
2816be168c0dSopenharmony_ci+ *
2817be168c0dSopenharmony_ci+ * Licensed under the Apache License, Version 2.0 (the "License");
2818be168c0dSopenharmony_ci+ * you may not use this file except in compliance with the License.
2819be168c0dSopenharmony_ci+ * You may obtain a copy of the License at
2820be168c0dSopenharmony_ci+ *
2821be168c0dSopenharmony_ci+ * http://www.apache.org/licenses/LICENSE-2.0
2822be168c0dSopenharmony_ci+ *
2823be168c0dSopenharmony_ci+ * Unless required by applicable law or agreed to in writing, software
2824be168c0dSopenharmony_ci+ * distributed under the License is distributed on an "AS IS" BASIS,
2825be168c0dSopenharmony_ci+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2826be168c0dSopenharmony_ci+ * See the License for the specific language governing permissions and
2827be168c0dSopenharmony_ci+ * limitations under the License.
2828be168c0dSopenharmony_ci+ */
2829be168c0dSopenharmony_ci+
2830be168c0dSopenharmony_ci+#include "mindir.h"
2831be168c0dSopenharmony_ci+#include "utils.h"
2832be168c0dSopenharmony_ci+#include "schema/model_generated.h"
2833be168c0dSopenharmony_ci+#include "mindir_memory_manager.h"
2834be168c0dSopenharmony_ci+
2835be168c0dSopenharmony_ci+namespace mindspore {
2836be168c0dSopenharmony_ci+namespace lite {
2837be168c0dSopenharmony_ci+// ********** SplitWithOverlap **********
2838be168c0dSopenharmony_ci+PrimitivePtr MindIR_SplitWithOverlap_CreatePrimitive(int64_t split_dim, int64_t number_split, const std::vector<int64_t> &ratio, const std::vector<int64_t> &extend_top, const std::vector<int64_t> &extend_bottom) {
2839be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
2840be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateSplitWithOverlap(fbb, split_dim, number_split, fbb.CreateVector(ratio.data(), ratio.size()), fbb.CreateVector(extend_top.data(), extend_top.size()), fbb.CreateVector(extend_bottom.data(), extend_bottom.size()));
2841be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SPLIT_WITH_OVERLAP), ops_offset.o);
2842be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
2843be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2844be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2845be168c0dSopenharmony_ci+  return ret_value;
2846be168c0dSopenharmony_ci+}
2847be168c0dSopenharmony_ci+
2848be168c0dSopenharmony_ci+int64_t MindIR_SplitWithOverlap_GetSplitDim(ConstPrimitivePtr primitive) {
2849be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2850be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2851be168c0dSopenharmony_ci+    auto value = prim->value_as_SplitWithOverlap();
2852be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2853be168c0dSopenharmony_ci+      return value->split_dim();
2854be168c0dSopenharmony_ci+    } else {
2855be168c0dSopenharmony_ci+      return 0;
2856be168c0dSopenharmony_ci+    }
2857be168c0dSopenharmony_ci+  } else {
2858be168c0dSopenharmony_ci+    return 0;
2859be168c0dSopenharmony_ci+  }
2860be168c0dSopenharmony_ci+}
2861be168c0dSopenharmony_ci+
2862be168c0dSopenharmony_ci+void MindIR_SplitWithOverlap_SetSplitDim(PrimitivePtr *primitive, int64_t split_dim) {
2863be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2864be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2865be168c0dSopenharmony_ci+    auto value = prim->value_as_SplitWithOverlap();
2866be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2867be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2868be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateSplitWithOverlap(fbb, split_dim, value->number_split(), fbb.CreateVector(value->ratio()->data(), value->ratio()->size()), fbb.CreateVector(value->extend_top()->data(), value->extend_top()->size()), fbb.CreateVector(value->extend_bottom()->data(), value->extend_bottom()->size()));
2869be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SPLIT_WITH_OVERLAP), ops_offset.o);
2870be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2871be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2872be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2873be168c0dSopenharmony_ci+      free(*primitive);
2874be168c0dSopenharmony_ci+      *primitive = ret_value;
2875be168c0dSopenharmony_ci+    }
2876be168c0dSopenharmony_ci+  }
2877be168c0dSopenharmony_ci+}
2878be168c0dSopenharmony_ci+
2879be168c0dSopenharmony_ci+int64_t MindIR_SplitWithOverlap_GetNumberSplit(ConstPrimitivePtr primitive) {
2880be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2881be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2882be168c0dSopenharmony_ci+    auto value = prim->value_as_SplitWithOverlap();
2883be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2884be168c0dSopenharmony_ci+      return value->number_split();
2885be168c0dSopenharmony_ci+    } else {
2886be168c0dSopenharmony_ci+      return 0;
2887be168c0dSopenharmony_ci+    }
2888be168c0dSopenharmony_ci+  } else {
2889be168c0dSopenharmony_ci+    return 0;
2890be168c0dSopenharmony_ci+  }
2891be168c0dSopenharmony_ci+}
2892be168c0dSopenharmony_ci+
2893be168c0dSopenharmony_ci+void MindIR_SplitWithOverlap_SetNumberSplit(PrimitivePtr *primitive, int64_t number_split) {
2894be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2895be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2896be168c0dSopenharmony_ci+    auto value = prim->value_as_SplitWithOverlap();
2897be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2898be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2899be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateSplitWithOverlap(fbb, value->split_dim(), number_split, fbb.CreateVector(value->ratio()->data(), value->ratio()->size()), fbb.CreateVector(value->extend_top()->data(), value->extend_top()->size()), fbb.CreateVector(value->extend_bottom()->data(), value->extend_bottom()->size()));
2900be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SPLIT_WITH_OVERLAP), ops_offset.o);
2901be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2902be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2903be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2904be168c0dSopenharmony_ci+      free(*primitive);
2905be168c0dSopenharmony_ci+      *primitive = ret_value;
2906be168c0dSopenharmony_ci+    }
2907be168c0dSopenharmony_ci+  }
2908be168c0dSopenharmony_ci+}
2909be168c0dSopenharmony_ci+
2910be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_SplitWithOverlap_GetRatio(ConstPrimitivePtr primitive) {
2911be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2912be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2913be168c0dSopenharmony_ci+    auto value = prim->value_as_SplitWithOverlap();
2914be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2915be168c0dSopenharmony_ci+      std::vector<int64_t> result;
2916be168c0dSopenharmony_ci+      auto src = value->ratio();
2917be168c0dSopenharmony_ci+      if (src == nullptr) {
2918be168c0dSopenharmony_ci+        return {};
2919be168c0dSopenharmony_ci+      }
2920be168c0dSopenharmony_ci+      result.resize(src->size());
2921be168c0dSopenharmony_ci+      std::transform(src->begin(), src->end(), result.begin(), [](int64_t item) { return item; });
2922be168c0dSopenharmony_ci+      return result;
2923be168c0dSopenharmony_ci+    } else {
2924be168c0dSopenharmony_ci+      return {};
2925be168c0dSopenharmony_ci+    }
2926be168c0dSopenharmony_ci+  } else {
2927be168c0dSopenharmony_ci+    return {};
2928be168c0dSopenharmony_ci+  }
2929be168c0dSopenharmony_ci+}
2930be168c0dSopenharmony_ci+
2931be168c0dSopenharmony_ci+void MindIR_SplitWithOverlap_SetRatio(PrimitivePtr *primitive, const std::vector<int64_t> &ratio) {
2932be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2933be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2934be168c0dSopenharmony_ci+    auto value = prim->value_as_SplitWithOverlap();
2935be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2936be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2937be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateSplitWithOverlap(fbb, value->split_dim(), value->number_split(), fbb.CreateVector(ratio.data(), ratio.size()), fbb.CreateVector(value->extend_top()->data(), value->extend_top()->size()), fbb.CreateVector(value->extend_bottom()->data(), value->extend_bottom()->size()));
2938be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SPLIT_WITH_OVERLAP), ops_offset.o);
2939be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2940be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2941be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2942be168c0dSopenharmony_ci+      free(*primitive);
2943be168c0dSopenharmony_ci+      *primitive = ret_value;
2944be168c0dSopenharmony_ci+    }
2945be168c0dSopenharmony_ci+  }
2946be168c0dSopenharmony_ci+}
2947be168c0dSopenharmony_ci+
2948be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_SplitWithOverlap_GetExtendTop(ConstPrimitivePtr primitive) {
2949be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2950be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2951be168c0dSopenharmony_ci+    auto value = prim->value_as_SplitWithOverlap();
2952be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2953be168c0dSopenharmony_ci+      std::vector<int64_t> result;
2954be168c0dSopenharmony_ci+      auto src = value->extend_top();
2955be168c0dSopenharmony_ci+      if (src == nullptr) {
2956be168c0dSopenharmony_ci+        return {};
2957be168c0dSopenharmony_ci+      }
2958be168c0dSopenharmony_ci+      result.resize(src->size());
2959be168c0dSopenharmony_ci+      std::transform(src->begin(), src->end(), result.begin(), [](int64_t item) { return item; });
2960be168c0dSopenharmony_ci+      return result;
2961be168c0dSopenharmony_ci+    } else {
2962be168c0dSopenharmony_ci+      return {};
2963be168c0dSopenharmony_ci+    }
2964be168c0dSopenharmony_ci+  } else {
2965be168c0dSopenharmony_ci+    return {};
2966be168c0dSopenharmony_ci+  }
2967be168c0dSopenharmony_ci+}
2968be168c0dSopenharmony_ci+
2969be168c0dSopenharmony_ci+void MindIR_SplitWithOverlap_SetExtendTop(PrimitivePtr *primitive, const std::vector<int64_t> &extend_top) {
2970be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
2971be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
2972be168c0dSopenharmony_ci+    auto value = prim->value_as_SplitWithOverlap();
2973be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2974be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
2975be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateSplitWithOverlap(fbb, value->split_dim(), value->number_split(), fbb.CreateVector(value->ratio()->data(), value->ratio()->size()), fbb.CreateVector(extend_top.data(), extend_top.size()), fbb.CreateVector(value->extend_bottom()->data(), value->extend_bottom()->size()));
2976be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SPLIT_WITH_OVERLAP), ops_offset.o);
2977be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
2978be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
2979be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
2980be168c0dSopenharmony_ci+      free(*primitive);
2981be168c0dSopenharmony_ci+      *primitive = ret_value;
2982be168c0dSopenharmony_ci+    }
2983be168c0dSopenharmony_ci+  }
2984be168c0dSopenharmony_ci+}
2985be168c0dSopenharmony_ci+
2986be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_SplitWithOverlap_GetExtendBottom(ConstPrimitivePtr primitive) {
2987be168c0dSopenharmony_ci+  if (primitive != nullptr) {
2988be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
2989be168c0dSopenharmony_ci+    auto value = prim->value_as_SplitWithOverlap();
2990be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
2991be168c0dSopenharmony_ci+      std::vector<int64_t> result;
2992be168c0dSopenharmony_ci+      auto src = value->extend_bottom();
2993be168c0dSopenharmony_ci+      if (src == nullptr) {
2994be168c0dSopenharmony_ci+        return {};
2995be168c0dSopenharmony_ci+      }
2996be168c0dSopenharmony_ci+      result.resize(src->size());
2997be168c0dSopenharmony_ci+      std::transform(src->begin(), src->end(), result.begin(), [](int64_t item) { return item; });
2998be168c0dSopenharmony_ci+      return result;
2999be168c0dSopenharmony_ci+    } else {
3000be168c0dSopenharmony_ci+      return {};
3001be168c0dSopenharmony_ci+    }
3002be168c0dSopenharmony_ci+  } else {
3003be168c0dSopenharmony_ci+    return {};
3004be168c0dSopenharmony_ci+  }
3005be168c0dSopenharmony_ci+}
3006be168c0dSopenharmony_ci+
3007be168c0dSopenharmony_ci+void MindIR_SplitWithOverlap_SetExtendBottom(PrimitivePtr *primitive, const std::vector<int64_t> &extend_bottom) {
3008be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3009be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3010be168c0dSopenharmony_ci+    auto value = prim->value_as_SplitWithOverlap();
3011be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3012be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3013be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateSplitWithOverlap(fbb, value->split_dim(), value->number_split(), fbb.CreateVector(value->ratio()->data(), value->ratio()->size()), fbb.CreateVector(value->extend_top()->data(), value->extend_top()->size()), fbb.CreateVector(extend_bottom.data(), extend_bottom.size()));
3014be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SPLIT_WITH_OVERLAP), ops_offset.o);
3015be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3016be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3017be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3018be168c0dSopenharmony_ci+      free(*primitive);
3019be168c0dSopenharmony_ci+      *primitive = ret_value;
3020be168c0dSopenharmony_ci+    }
3021be168c0dSopenharmony_ci+  }
3022be168c0dSopenharmony_ci+}
3023be168c0dSopenharmony_ci+
3024be168c0dSopenharmony_ci+// ********** GenOP **********
3025be168c0dSopenharmony_ci+PrimitivePtr MindIR_GenOP_CreatePrimitive(ActivationType activation_type, float alpha, float min_val, float max_val, bool is_training, Format format, const std::vector<int64_t> &kernel_size, const std::vector<int64_t> &stride, const std::vector<int64_t> &dilation, PadMode pad_mode, const std::vector<int64_t> &pad_list, int64_t mode, int64_t group, int64_t in_channel, int64_t out_channel, EltwiseMode eltwise_mode, bool has_bias, bool use_axis, int64_t axis, float epsilon, float momentum, bool transpose_a, bool transpose_b, const std::vector<int64_t> &pad, RoundMode round_mode, bool global, bool channel_shared, const std::vector<int64_t> &axes, bool keep_dims, ReduceMode reduce_mode, bool reduce_to_end, float coeff) {
3026be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
3027be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(activation_type), alpha, min_val, max_val, is_training, static_cast<schema::Format>(format), fbb.CreateVector(kernel_size.data(), kernel_size.size()), fbb.CreateVector(stride.data(), stride.size()), fbb.CreateVector(dilation.data(), dilation.size()), static_cast<schema::PadMode>(pad_mode), fbb.CreateVector(pad_list.data(), pad_list.size()), mode, group, in_channel, out_channel, static_cast<schema::EltwiseMode>(eltwise_mode), has_bias, use_axis, axis, epsilon, momentum, transpose_a, transpose_b, fbb.CreateVector(pad.data(), pad.size()), static_cast<schema::RoundMode>(round_mode), global, channel_shared, fbb.CreateVector(axes.data(), axes.size()), keep_dims, static_cast<schema::ReduceMode>(reduce_mode), reduce_to_end, coeff);
3028be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3029be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
3030be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3031be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3032be168c0dSopenharmony_ci+  return ret_value;
3033be168c0dSopenharmony_ci+}
3034be168c0dSopenharmony_ci+
3035be168c0dSopenharmony_ci+ActivationType MindIR_GenOP_GetActivationType(ConstPrimitivePtr primitive) {
3036be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3037be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3038be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3039be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3040be168c0dSopenharmony_ci+      return static_cast<ActivationType>(value->activation_type());
3041be168c0dSopenharmony_ci+    } else {
3042be168c0dSopenharmony_ci+      ActivationType en = static_cast<ActivationType>(0);
3043be168c0dSopenharmony_ci+      return en;
3044be168c0dSopenharmony_ci+    }
3045be168c0dSopenharmony_ci+  } else {
3046be168c0dSopenharmony_ci+    ActivationType en = static_cast<ActivationType>(0);
3047be168c0dSopenharmony_ci+    return en;
3048be168c0dSopenharmony_ci+  }
3049be168c0dSopenharmony_ci+}
3050be168c0dSopenharmony_ci+
3051be168c0dSopenharmony_ci+void MindIR_GenOP_SetActivationType(PrimitivePtr *primitive, ActivationType activation_type) {
3052be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3053be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3054be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3055be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3056be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3057be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(activation_type), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3058be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3059be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3060be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3061be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3062be168c0dSopenharmony_ci+      free(*primitive);
3063be168c0dSopenharmony_ci+      *primitive = ret_value;
3064be168c0dSopenharmony_ci+    }
3065be168c0dSopenharmony_ci+  }
3066be168c0dSopenharmony_ci+}
3067be168c0dSopenharmony_ci+
3068be168c0dSopenharmony_ci+float MindIR_GenOP_GetAlpha(ConstPrimitivePtr primitive) {
3069be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3070be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3071be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3072be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3073be168c0dSopenharmony_ci+      return value->alpha();
3074be168c0dSopenharmony_ci+    } else {
3075be168c0dSopenharmony_ci+      return .0;
3076be168c0dSopenharmony_ci+    }
3077be168c0dSopenharmony_ci+  } else {
3078be168c0dSopenharmony_ci+    return .0;
3079be168c0dSopenharmony_ci+  }
3080be168c0dSopenharmony_ci+}
3081be168c0dSopenharmony_ci+
3082be168c0dSopenharmony_ci+void MindIR_GenOP_SetAlpha(PrimitivePtr *primitive, float alpha) {
3083be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3084be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3085be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3086be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3087be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3088be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), alpha, value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3089be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3090be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3091be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3092be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3093be168c0dSopenharmony_ci+      free(*primitive);
3094be168c0dSopenharmony_ci+      *primitive = ret_value;
3095be168c0dSopenharmony_ci+    }
3096be168c0dSopenharmony_ci+  }
3097be168c0dSopenharmony_ci+}
3098be168c0dSopenharmony_ci+
3099be168c0dSopenharmony_ci+float MindIR_GenOP_GetMinVal(ConstPrimitivePtr primitive) {
3100be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3101be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3102be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3103be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3104be168c0dSopenharmony_ci+      return value->min_val();
3105be168c0dSopenharmony_ci+    } else {
3106be168c0dSopenharmony_ci+      return .0;
3107be168c0dSopenharmony_ci+    }
3108be168c0dSopenharmony_ci+  } else {
3109be168c0dSopenharmony_ci+    return .0;
3110be168c0dSopenharmony_ci+  }
3111be168c0dSopenharmony_ci+}
3112be168c0dSopenharmony_ci+
3113be168c0dSopenharmony_ci+void MindIR_GenOP_SetMinVal(PrimitivePtr *primitive, float min_val) {
3114be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3115be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3116be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3117be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3118be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3119be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), min_val, value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3120be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3121be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3122be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3123be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3124be168c0dSopenharmony_ci+      free(*primitive);
3125be168c0dSopenharmony_ci+      *primitive = ret_value;
3126be168c0dSopenharmony_ci+    }
3127be168c0dSopenharmony_ci+  }
3128be168c0dSopenharmony_ci+}
3129be168c0dSopenharmony_ci+
3130be168c0dSopenharmony_ci+float MindIR_GenOP_GetMaxVal(ConstPrimitivePtr primitive) {
3131be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3132be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3133be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3134be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3135be168c0dSopenharmony_ci+      return value->max_val();
3136be168c0dSopenharmony_ci+    } else {
3137be168c0dSopenharmony_ci+      return .0;
3138be168c0dSopenharmony_ci+    }
3139be168c0dSopenharmony_ci+  } else {
3140be168c0dSopenharmony_ci+    return .0;
3141be168c0dSopenharmony_ci+  }
3142be168c0dSopenharmony_ci+}
3143be168c0dSopenharmony_ci+
3144be168c0dSopenharmony_ci+void MindIR_GenOP_SetMaxVal(PrimitivePtr *primitive, float max_val) {
3145be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3146be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3147be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3148be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3149be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3150be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), max_val, value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3151be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3152be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3153be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3154be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3155be168c0dSopenharmony_ci+      free(*primitive);
3156be168c0dSopenharmony_ci+      *primitive = ret_value;
3157be168c0dSopenharmony_ci+    }
3158be168c0dSopenharmony_ci+  }
3159be168c0dSopenharmony_ci+}
3160be168c0dSopenharmony_ci+
3161be168c0dSopenharmony_ci+bool MindIR_GenOP_GetIsTraining(ConstPrimitivePtr primitive) {
3162be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3163be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3164be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3165be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3166be168c0dSopenharmony_ci+      return value->is_training();
3167be168c0dSopenharmony_ci+    } else {
3168be168c0dSopenharmony_ci+      return false;
3169be168c0dSopenharmony_ci+    }
3170be168c0dSopenharmony_ci+  } else {
3171be168c0dSopenharmony_ci+    return false;
3172be168c0dSopenharmony_ci+  }
3173be168c0dSopenharmony_ci+}
3174be168c0dSopenharmony_ci+
3175be168c0dSopenharmony_ci+void MindIR_GenOP_SetIsTraining(PrimitivePtr *primitive, bool is_training) {
3176be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3177be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3178be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3179be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3180be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3181be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), is_training, static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3182be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3183be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3184be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3185be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3186be168c0dSopenharmony_ci+      free(*primitive);
3187be168c0dSopenharmony_ci+      *primitive = ret_value;
3188be168c0dSopenharmony_ci+    }
3189be168c0dSopenharmony_ci+  }
3190be168c0dSopenharmony_ci+}
3191be168c0dSopenharmony_ci+
3192be168c0dSopenharmony_ci+Format MindIR_GenOP_GetFormat(ConstPrimitivePtr primitive) {
3193be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3194be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3195be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3196be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3197be168c0dSopenharmony_ci+      return static_cast<Format>(value->format());
3198be168c0dSopenharmony_ci+    } else {
3199be168c0dSopenharmony_ci+      Format en = static_cast<Format>(0);
3200be168c0dSopenharmony_ci+      return en;
3201be168c0dSopenharmony_ci+    }
3202be168c0dSopenharmony_ci+  } else {
3203be168c0dSopenharmony_ci+    Format en = static_cast<Format>(0);
3204be168c0dSopenharmony_ci+    return en;
3205be168c0dSopenharmony_ci+  }
3206be168c0dSopenharmony_ci+}
3207be168c0dSopenharmony_ci+
3208be168c0dSopenharmony_ci+void MindIR_GenOP_SetFormat(PrimitivePtr *primitive, Format format) {
3209be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3210be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3211be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3212be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3213be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3214be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(format), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3215be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3216be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3217be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3218be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3219be168c0dSopenharmony_ci+      free(*primitive);
3220be168c0dSopenharmony_ci+      *primitive = ret_value;
3221be168c0dSopenharmony_ci+    }
3222be168c0dSopenharmony_ci+  }
3223be168c0dSopenharmony_ci+}
3224be168c0dSopenharmony_ci+
3225be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_GenOP_GetKernelSize(ConstPrimitivePtr primitive) {
3226be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3227be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3228be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3229be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3230be168c0dSopenharmony_ci+      std::vector<int64_t> result;
3231be168c0dSopenharmony_ci+      auto src = value->kernel_size();
3232be168c0dSopenharmony_ci+      if (src == nullptr) {
3233be168c0dSopenharmony_ci+        return {};
3234be168c0dSopenharmony_ci+      }
3235be168c0dSopenharmony_ci+      result.resize(src->size());
3236be168c0dSopenharmony_ci+      std::transform(src->begin(), src->end(), result.begin(), [](int64_t item) { return item; });
3237be168c0dSopenharmony_ci+      return result;
3238be168c0dSopenharmony_ci+    } else {
3239be168c0dSopenharmony_ci+      return {};
3240be168c0dSopenharmony_ci+    }
3241be168c0dSopenharmony_ci+  } else {
3242be168c0dSopenharmony_ci+    return {};
3243be168c0dSopenharmony_ci+  }
3244be168c0dSopenharmony_ci+}
3245be168c0dSopenharmony_ci+
3246be168c0dSopenharmony_ci+void MindIR_GenOP_SetKernelSize(PrimitivePtr *primitive, const std::vector<int64_t> &kernel_size) {
3247be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3248be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3249be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3250be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3251be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3252be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(kernel_size.data(), kernel_size.size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3253be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3254be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3255be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3256be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3257be168c0dSopenharmony_ci+      free(*primitive);
3258be168c0dSopenharmony_ci+      *primitive = ret_value;
3259be168c0dSopenharmony_ci+    }
3260be168c0dSopenharmony_ci+  }
3261be168c0dSopenharmony_ci+}
3262be168c0dSopenharmony_ci+
3263be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_GenOP_GetStride(ConstPrimitivePtr primitive) {
3264be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3265be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3266be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3267be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3268be168c0dSopenharmony_ci+      std::vector<int64_t> result;
3269be168c0dSopenharmony_ci+      auto src = value->stride();
3270be168c0dSopenharmony_ci+      if (src == nullptr) {
3271be168c0dSopenharmony_ci+        return {};
3272be168c0dSopenharmony_ci+      }
3273be168c0dSopenharmony_ci+      result.resize(src->size());
3274be168c0dSopenharmony_ci+      std::transform(src->begin(), src->end(), result.begin(), [](int64_t item) { return item; });
3275be168c0dSopenharmony_ci+      return result;
3276be168c0dSopenharmony_ci+    } else {
3277be168c0dSopenharmony_ci+      return {};
3278be168c0dSopenharmony_ci+    }
3279be168c0dSopenharmony_ci+  } else {
3280be168c0dSopenharmony_ci+    return {};
3281be168c0dSopenharmony_ci+  }
3282be168c0dSopenharmony_ci+}
3283be168c0dSopenharmony_ci+
3284be168c0dSopenharmony_ci+void MindIR_GenOP_SetStride(PrimitivePtr *primitive, const std::vector<int64_t> &stride) {
3285be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3286be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3287be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3288be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3289be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3290be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(stride.data(), stride.size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3291be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3292be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3293be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3294be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3295be168c0dSopenharmony_ci+      free(*primitive);
3296be168c0dSopenharmony_ci+      *primitive = ret_value;
3297be168c0dSopenharmony_ci+    }
3298be168c0dSopenharmony_ci+  }
3299be168c0dSopenharmony_ci+}
3300be168c0dSopenharmony_ci+
3301be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_GenOP_GetDilation(ConstPrimitivePtr primitive) {
3302be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3303be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3304be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3305be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3306be168c0dSopenharmony_ci+      std::vector<int64_t> result;
3307be168c0dSopenharmony_ci+      auto src = value->dilation();
3308be168c0dSopenharmony_ci+      if (src == nullptr) {
3309be168c0dSopenharmony_ci+        return {};
3310be168c0dSopenharmony_ci+      }
3311be168c0dSopenharmony_ci+      result.resize(src->size());
3312be168c0dSopenharmony_ci+      std::transform(src->begin(), src->end(), result.begin(), [](int64_t item) { return item; });
3313be168c0dSopenharmony_ci+      return result;
3314be168c0dSopenharmony_ci+    } else {
3315be168c0dSopenharmony_ci+      return {};
3316be168c0dSopenharmony_ci+    }
3317be168c0dSopenharmony_ci+  } else {
3318be168c0dSopenharmony_ci+    return {};
3319be168c0dSopenharmony_ci+  }
3320be168c0dSopenharmony_ci+}
3321be168c0dSopenharmony_ci+
3322be168c0dSopenharmony_ci+void MindIR_GenOP_SetDilation(PrimitivePtr *primitive, const std::vector<int64_t> &dilation) {
3323be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3324be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3325be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3326be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3327be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3328be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(dilation.data(), dilation.size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3329be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3330be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3331be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3332be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3333be168c0dSopenharmony_ci+      free(*primitive);
3334be168c0dSopenharmony_ci+      *primitive = ret_value;
3335be168c0dSopenharmony_ci+    }
3336be168c0dSopenharmony_ci+  }
3337be168c0dSopenharmony_ci+}
3338be168c0dSopenharmony_ci+
3339be168c0dSopenharmony_ci+PadMode MindIR_GenOP_GetPadMode(ConstPrimitivePtr primitive) {
3340be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3341be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3342be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3343be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3344be168c0dSopenharmony_ci+      return static_cast<PadMode>(value->pad_mode());
3345be168c0dSopenharmony_ci+    } else {
3346be168c0dSopenharmony_ci+      PadMode en = static_cast<PadMode>(0);
3347be168c0dSopenharmony_ci+      return en;
3348be168c0dSopenharmony_ci+    }
3349be168c0dSopenharmony_ci+  } else {
3350be168c0dSopenharmony_ci+    PadMode en = static_cast<PadMode>(0);
3351be168c0dSopenharmony_ci+    return en;
3352be168c0dSopenharmony_ci+  }
3353be168c0dSopenharmony_ci+}
3354be168c0dSopenharmony_ci+
3355be168c0dSopenharmony_ci+void MindIR_GenOP_SetPadMode(PrimitivePtr *primitive, PadMode pad_mode) {
3356be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3357be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3358be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3359be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3360be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3361be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(pad_mode), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3362be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3363be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3364be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3365be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3366be168c0dSopenharmony_ci+      free(*primitive);
3367be168c0dSopenharmony_ci+      *primitive = ret_value;
3368be168c0dSopenharmony_ci+    }
3369be168c0dSopenharmony_ci+  }
3370be168c0dSopenharmony_ci+}
3371be168c0dSopenharmony_ci+
3372be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_GenOP_GetPadList(ConstPrimitivePtr primitive) {
3373be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3374be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3375be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3376be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3377be168c0dSopenharmony_ci+      std::vector<int64_t> result;
3378be168c0dSopenharmony_ci+      auto src = value->pad_list();
3379be168c0dSopenharmony_ci+      if (src == nullptr) {
3380be168c0dSopenharmony_ci+        return {};
3381be168c0dSopenharmony_ci+      }
3382be168c0dSopenharmony_ci+      result.resize(src->size());
3383be168c0dSopenharmony_ci+      std::transform(src->begin(), src->end(), result.begin(), [](int64_t item) { return item; });
3384be168c0dSopenharmony_ci+      return result;
3385be168c0dSopenharmony_ci+    } else {
3386be168c0dSopenharmony_ci+      return {};
3387be168c0dSopenharmony_ci+    }
3388be168c0dSopenharmony_ci+  } else {
3389be168c0dSopenharmony_ci+    return {};
3390be168c0dSopenharmony_ci+  }
3391be168c0dSopenharmony_ci+}
3392be168c0dSopenharmony_ci+
3393be168c0dSopenharmony_ci+void MindIR_GenOP_SetPadList(PrimitivePtr *primitive, const std::vector<int64_t> &pad_list) {
3394be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3395be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3396be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3397be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3398be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3399be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(pad_list.data(), pad_list.size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3400be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3401be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3402be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3403be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3404be168c0dSopenharmony_ci+      free(*primitive);
3405be168c0dSopenharmony_ci+      *primitive = ret_value;
3406be168c0dSopenharmony_ci+    }
3407be168c0dSopenharmony_ci+  }
3408be168c0dSopenharmony_ci+}
3409be168c0dSopenharmony_ci+
3410be168c0dSopenharmony_ci+int64_t MindIR_GenOP_GetMode(ConstPrimitivePtr primitive) {
3411be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3412be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3413be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3414be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3415be168c0dSopenharmony_ci+      return value->mode();
3416be168c0dSopenharmony_ci+    } else {
3417be168c0dSopenharmony_ci+      return 0;
3418be168c0dSopenharmony_ci+    }
3419be168c0dSopenharmony_ci+  } else {
3420be168c0dSopenharmony_ci+    return 0;
3421be168c0dSopenharmony_ci+  }
3422be168c0dSopenharmony_ci+}
3423be168c0dSopenharmony_ci+
3424be168c0dSopenharmony_ci+void MindIR_GenOP_SetMode(PrimitivePtr *primitive, int64_t mode) {
3425be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3426be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3427be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3428be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3429be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3430be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), mode, value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3431be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3432be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3433be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3434be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3435be168c0dSopenharmony_ci+      free(*primitive);
3436be168c0dSopenharmony_ci+      *primitive = ret_value;
3437be168c0dSopenharmony_ci+    }
3438be168c0dSopenharmony_ci+  }
3439be168c0dSopenharmony_ci+}
3440be168c0dSopenharmony_ci+
3441be168c0dSopenharmony_ci+int64_t MindIR_GenOP_GetGroup(ConstPrimitivePtr primitive) {
3442be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3443be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3444be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3445be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3446be168c0dSopenharmony_ci+      return value->group();
3447be168c0dSopenharmony_ci+    } else {
3448be168c0dSopenharmony_ci+      return 0;
3449be168c0dSopenharmony_ci+    }
3450be168c0dSopenharmony_ci+  } else {
3451be168c0dSopenharmony_ci+    return 0;
3452be168c0dSopenharmony_ci+  }
3453be168c0dSopenharmony_ci+}
3454be168c0dSopenharmony_ci+
3455be168c0dSopenharmony_ci+void MindIR_GenOP_SetGroup(PrimitivePtr *primitive, int64_t group) {
3456be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3457be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3458be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3459be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3460be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3461be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), group, value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3462be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3463be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3464be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3465be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3466be168c0dSopenharmony_ci+      free(*primitive);
3467be168c0dSopenharmony_ci+      *primitive = ret_value;
3468be168c0dSopenharmony_ci+    }
3469be168c0dSopenharmony_ci+  }
3470be168c0dSopenharmony_ci+}
3471be168c0dSopenharmony_ci+
3472be168c0dSopenharmony_ci+int64_t MindIR_GenOP_GetInChannel(ConstPrimitivePtr primitive) {
3473be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3474be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3475be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3476be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3477be168c0dSopenharmony_ci+      return value->in_channel();
3478be168c0dSopenharmony_ci+    } else {
3479be168c0dSopenharmony_ci+      return 0;
3480be168c0dSopenharmony_ci+    }
3481be168c0dSopenharmony_ci+  } else {
3482be168c0dSopenharmony_ci+    return 0;
3483be168c0dSopenharmony_ci+  }
3484be168c0dSopenharmony_ci+}
3485be168c0dSopenharmony_ci+
3486be168c0dSopenharmony_ci+void MindIR_GenOP_SetInChannel(PrimitivePtr *primitive, int64_t in_channel) {
3487be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3488be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3489be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3490be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3491be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3492be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), in_channel, value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3493be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3494be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3495be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3496be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3497be168c0dSopenharmony_ci+      free(*primitive);
3498be168c0dSopenharmony_ci+      *primitive = ret_value;
3499be168c0dSopenharmony_ci+    }
3500be168c0dSopenharmony_ci+  }
3501be168c0dSopenharmony_ci+}
3502be168c0dSopenharmony_ci+
3503be168c0dSopenharmony_ci+int64_t MindIR_GenOP_GetOutChannel(ConstPrimitivePtr primitive) {
3504be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3505be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3506be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3507be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3508be168c0dSopenharmony_ci+      return value->out_channel();
3509be168c0dSopenharmony_ci+    } else {
3510be168c0dSopenharmony_ci+      return 0;
3511be168c0dSopenharmony_ci+    }
3512be168c0dSopenharmony_ci+  } else {
3513be168c0dSopenharmony_ci+    return 0;
3514be168c0dSopenharmony_ci+  }
3515be168c0dSopenharmony_ci+}
3516be168c0dSopenharmony_ci+
3517be168c0dSopenharmony_ci+void MindIR_GenOP_SetOutChannel(PrimitivePtr *primitive, int64_t out_channel) {
3518be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3519be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3520be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3521be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3522be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3523be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), out_channel, static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3524be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3525be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3526be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3527be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3528be168c0dSopenharmony_ci+      free(*primitive);
3529be168c0dSopenharmony_ci+      *primitive = ret_value;
3530be168c0dSopenharmony_ci+    }
3531be168c0dSopenharmony_ci+  }
3532be168c0dSopenharmony_ci+}
3533be168c0dSopenharmony_ci+
3534be168c0dSopenharmony_ci+EltwiseMode MindIR_GenOP_GetEltwiseMode(ConstPrimitivePtr primitive) {
3535be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3536be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3537be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3538be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3539be168c0dSopenharmony_ci+      return static_cast<EltwiseMode>(value->eltwise_mode());
3540be168c0dSopenharmony_ci+    } else {
3541be168c0dSopenharmony_ci+      EltwiseMode en = static_cast<EltwiseMode>(0);
3542be168c0dSopenharmony_ci+      return en;
3543be168c0dSopenharmony_ci+    }
3544be168c0dSopenharmony_ci+  } else {
3545be168c0dSopenharmony_ci+    EltwiseMode en = static_cast<EltwiseMode>(0);
3546be168c0dSopenharmony_ci+    return en;
3547be168c0dSopenharmony_ci+  }
3548be168c0dSopenharmony_ci+}
3549be168c0dSopenharmony_ci+
3550be168c0dSopenharmony_ci+void MindIR_GenOP_SetEltwiseMode(PrimitivePtr *primitive, EltwiseMode eltwise_mode) {
3551be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3552be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3553be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3554be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3555be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3556be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(eltwise_mode), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3557be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3558be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3559be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3560be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3561be168c0dSopenharmony_ci+      free(*primitive);
3562be168c0dSopenharmony_ci+      *primitive = ret_value;
3563be168c0dSopenharmony_ci+    }
3564be168c0dSopenharmony_ci+  }
3565be168c0dSopenharmony_ci+}
3566be168c0dSopenharmony_ci+
3567be168c0dSopenharmony_ci+bool MindIR_GenOP_GetHasBias(ConstPrimitivePtr primitive) {
3568be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3569be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3570be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3571be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3572be168c0dSopenharmony_ci+      return value->has_bias();
3573be168c0dSopenharmony_ci+    } else {
3574be168c0dSopenharmony_ci+      return false;
3575be168c0dSopenharmony_ci+    }
3576be168c0dSopenharmony_ci+  } else {
3577be168c0dSopenharmony_ci+    return false;
3578be168c0dSopenharmony_ci+  }
3579be168c0dSopenharmony_ci+}
3580be168c0dSopenharmony_ci+
3581be168c0dSopenharmony_ci+void MindIR_GenOP_SetHasBias(PrimitivePtr *primitive, bool has_bias) {
3582be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3583be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3584be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3585be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3586be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3587be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), has_bias, value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3588be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3589be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3590be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3591be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3592be168c0dSopenharmony_ci+      free(*primitive);
3593be168c0dSopenharmony_ci+      *primitive = ret_value;
3594be168c0dSopenharmony_ci+    }
3595be168c0dSopenharmony_ci+  }
3596be168c0dSopenharmony_ci+}
3597be168c0dSopenharmony_ci+
3598be168c0dSopenharmony_ci+bool MindIR_GenOP_GetUseAxis(ConstPrimitivePtr primitive) {
3599be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3600be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3601be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3602be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3603be168c0dSopenharmony_ci+      return value->use_axis();
3604be168c0dSopenharmony_ci+    } else {
3605be168c0dSopenharmony_ci+      return false;
3606be168c0dSopenharmony_ci+    }
3607be168c0dSopenharmony_ci+  } else {
3608be168c0dSopenharmony_ci+    return false;
3609be168c0dSopenharmony_ci+  }
3610be168c0dSopenharmony_ci+}
3611be168c0dSopenharmony_ci+
3612be168c0dSopenharmony_ci+void MindIR_GenOP_SetUseAxis(PrimitivePtr *primitive, bool use_axis) {
3613be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3614be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3615be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3616be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3617be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3618be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), use_axis, value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3619be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3620be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3621be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3622be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3623be168c0dSopenharmony_ci+      free(*primitive);
3624be168c0dSopenharmony_ci+      *primitive = ret_value;
3625be168c0dSopenharmony_ci+    }
3626be168c0dSopenharmony_ci+  }
3627be168c0dSopenharmony_ci+}
3628be168c0dSopenharmony_ci+
3629be168c0dSopenharmony_ci+int64_t MindIR_GenOP_GetAxis(ConstPrimitivePtr primitive) {
3630be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3631be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3632be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3633be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3634be168c0dSopenharmony_ci+      return value->axis();
3635be168c0dSopenharmony_ci+    } else {
3636be168c0dSopenharmony_ci+      return 0;
3637be168c0dSopenharmony_ci+    }
3638be168c0dSopenharmony_ci+  } else {
3639be168c0dSopenharmony_ci+    return 0;
3640be168c0dSopenharmony_ci+  }
3641be168c0dSopenharmony_ci+}
3642be168c0dSopenharmony_ci+
3643be168c0dSopenharmony_ci+void MindIR_GenOP_SetAxis(PrimitivePtr *primitive, int64_t axis) {
3644be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3645be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3646be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3647be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3648be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3649be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), axis, value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3650be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3651be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3652be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3653be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3654be168c0dSopenharmony_ci+      free(*primitive);
3655be168c0dSopenharmony_ci+      *primitive = ret_value;
3656be168c0dSopenharmony_ci+    }
3657be168c0dSopenharmony_ci+  }
3658be168c0dSopenharmony_ci+}
3659be168c0dSopenharmony_ci+
3660be168c0dSopenharmony_ci+float MindIR_GenOP_GetEpsilon(ConstPrimitivePtr primitive) {
3661be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3662be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3663be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3664be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3665be168c0dSopenharmony_ci+      return value->epsilon();
3666be168c0dSopenharmony_ci+    } else {
3667be168c0dSopenharmony_ci+      return .0;
3668be168c0dSopenharmony_ci+    }
3669be168c0dSopenharmony_ci+  } else {
3670be168c0dSopenharmony_ci+    return .0;
3671be168c0dSopenharmony_ci+  }
3672be168c0dSopenharmony_ci+}
3673be168c0dSopenharmony_ci+
3674be168c0dSopenharmony_ci+void MindIR_GenOP_SetEpsilon(PrimitivePtr *primitive, float epsilon) {
3675be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3676be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3677be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3678be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3679be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3680be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), epsilon, value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3681be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3682be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3683be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3684be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3685be168c0dSopenharmony_ci+      free(*primitive);
3686be168c0dSopenharmony_ci+      *primitive = ret_value;
3687be168c0dSopenharmony_ci+    }
3688be168c0dSopenharmony_ci+  }
3689be168c0dSopenharmony_ci+}
3690be168c0dSopenharmony_ci+
3691be168c0dSopenharmony_ci+float MindIR_GenOP_GetMomentum(ConstPrimitivePtr primitive) {
3692be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3693be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3694be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3695be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3696be168c0dSopenharmony_ci+      return value->momentum();
3697be168c0dSopenharmony_ci+    } else {
3698be168c0dSopenharmony_ci+      return .0;
3699be168c0dSopenharmony_ci+    }
3700be168c0dSopenharmony_ci+  } else {
3701be168c0dSopenharmony_ci+    return .0;
3702be168c0dSopenharmony_ci+  }
3703be168c0dSopenharmony_ci+}
3704be168c0dSopenharmony_ci+
3705be168c0dSopenharmony_ci+void MindIR_GenOP_SetMomentum(PrimitivePtr *primitive, float momentum) {
3706be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3707be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3708be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3709be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3710be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3711be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), momentum, value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3712be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3713be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3714be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3715be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3716be168c0dSopenharmony_ci+      free(*primitive);
3717be168c0dSopenharmony_ci+      *primitive = ret_value;
3718be168c0dSopenharmony_ci+    }
3719be168c0dSopenharmony_ci+  }
3720be168c0dSopenharmony_ci+}
3721be168c0dSopenharmony_ci+
3722be168c0dSopenharmony_ci+bool MindIR_GenOP_GetTransposeA(ConstPrimitivePtr primitive) {
3723be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3724be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3725be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3726be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3727be168c0dSopenharmony_ci+      return value->transpose_a();
3728be168c0dSopenharmony_ci+    } else {
3729be168c0dSopenharmony_ci+      return false;
3730be168c0dSopenharmony_ci+    }
3731be168c0dSopenharmony_ci+  } else {
3732be168c0dSopenharmony_ci+    return false;
3733be168c0dSopenharmony_ci+  }
3734be168c0dSopenharmony_ci+}
3735be168c0dSopenharmony_ci+
3736be168c0dSopenharmony_ci+void MindIR_GenOP_SetTransposeA(PrimitivePtr *primitive, bool transpose_a) {
3737be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3738be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3739be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3740be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3741be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3742be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), transpose_a, value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3743be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3744be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3745be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3746be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3747be168c0dSopenharmony_ci+      free(*primitive);
3748be168c0dSopenharmony_ci+      *primitive = ret_value;
3749be168c0dSopenharmony_ci+    }
3750be168c0dSopenharmony_ci+  }
3751be168c0dSopenharmony_ci+}
3752be168c0dSopenharmony_ci+
3753be168c0dSopenharmony_ci+bool MindIR_GenOP_GetTransposeB(ConstPrimitivePtr primitive) {
3754be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3755be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3756be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3757be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3758be168c0dSopenharmony_ci+      return value->transpose_b();
3759be168c0dSopenharmony_ci+    } else {
3760be168c0dSopenharmony_ci+      return false;
3761be168c0dSopenharmony_ci+    }
3762be168c0dSopenharmony_ci+  } else {
3763be168c0dSopenharmony_ci+    return false;
3764be168c0dSopenharmony_ci+  }
3765be168c0dSopenharmony_ci+}
3766be168c0dSopenharmony_ci+
3767be168c0dSopenharmony_ci+void MindIR_GenOP_SetTransposeB(PrimitivePtr *primitive, bool transpose_b) {
3768be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3769be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3770be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3771be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3772be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3773be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), transpose_b, fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3774be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3775be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3776be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3777be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3778be168c0dSopenharmony_ci+      free(*primitive);
3779be168c0dSopenharmony_ci+      *primitive = ret_value;
3780be168c0dSopenharmony_ci+    }
3781be168c0dSopenharmony_ci+  }
3782be168c0dSopenharmony_ci+}
3783be168c0dSopenharmony_ci+
3784be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_GenOP_GetPad(ConstPrimitivePtr primitive) {
3785be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3786be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3787be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3788be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3789be168c0dSopenharmony_ci+      std::vector<int64_t> result;
3790be168c0dSopenharmony_ci+      auto src = value->pad();
3791be168c0dSopenharmony_ci+      if (src == nullptr) {
3792be168c0dSopenharmony_ci+        return {};
3793be168c0dSopenharmony_ci+      }
3794be168c0dSopenharmony_ci+      result.resize(src->size());
3795be168c0dSopenharmony_ci+      std::transform(src->begin(), src->end(), result.begin(), [](int64_t item) { return item; });
3796be168c0dSopenharmony_ci+      return result;
3797be168c0dSopenharmony_ci+    } else {
3798be168c0dSopenharmony_ci+      return {};
3799be168c0dSopenharmony_ci+    }
3800be168c0dSopenharmony_ci+  } else {
3801be168c0dSopenharmony_ci+    return {};
3802be168c0dSopenharmony_ci+  }
3803be168c0dSopenharmony_ci+}
3804be168c0dSopenharmony_ci+
3805be168c0dSopenharmony_ci+void MindIR_GenOP_SetPad(PrimitivePtr *primitive, const std::vector<int64_t> &pad) {
3806be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3807be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3808be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3809be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3810be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3811be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(pad.data(), pad.size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3812be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3813be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3814be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3815be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3816be168c0dSopenharmony_ci+      free(*primitive);
3817be168c0dSopenharmony_ci+      *primitive = ret_value;
3818be168c0dSopenharmony_ci+    }
3819be168c0dSopenharmony_ci+  }
3820be168c0dSopenharmony_ci+}
3821be168c0dSopenharmony_ci+
3822be168c0dSopenharmony_ci+RoundMode MindIR_GenOP_GetRoundMode(ConstPrimitivePtr primitive) {
3823be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3824be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3825be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3826be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3827be168c0dSopenharmony_ci+      return static_cast<RoundMode>(value->round_mode());
3828be168c0dSopenharmony_ci+    } else {
3829be168c0dSopenharmony_ci+      RoundMode en = static_cast<RoundMode>(0);
3830be168c0dSopenharmony_ci+      return en;
3831be168c0dSopenharmony_ci+    }
3832be168c0dSopenharmony_ci+  } else {
3833be168c0dSopenharmony_ci+    RoundMode en = static_cast<RoundMode>(0);
3834be168c0dSopenharmony_ci+    return en;
3835be168c0dSopenharmony_ci+  }
3836be168c0dSopenharmony_ci+}
3837be168c0dSopenharmony_ci+
3838be168c0dSopenharmony_ci+void MindIR_GenOP_SetRoundMode(PrimitivePtr *primitive, RoundMode round_mode) {
3839be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3840be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3841be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3842be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3843be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3844be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(round_mode), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3845be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3846be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3847be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3848be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3849be168c0dSopenharmony_ci+      free(*primitive);
3850be168c0dSopenharmony_ci+      *primitive = ret_value;
3851be168c0dSopenharmony_ci+    }
3852be168c0dSopenharmony_ci+  }
3853be168c0dSopenharmony_ci+}
3854be168c0dSopenharmony_ci+
3855be168c0dSopenharmony_ci+bool MindIR_GenOP_GetGlobal(ConstPrimitivePtr primitive) {
3856be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3857be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3858be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3859be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3860be168c0dSopenharmony_ci+      return value->global();
3861be168c0dSopenharmony_ci+    } else {
3862be168c0dSopenharmony_ci+      return false;
3863be168c0dSopenharmony_ci+    }
3864be168c0dSopenharmony_ci+  } else {
3865be168c0dSopenharmony_ci+    return false;
3866be168c0dSopenharmony_ci+  }
3867be168c0dSopenharmony_ci+}
3868be168c0dSopenharmony_ci+
3869be168c0dSopenharmony_ci+void MindIR_GenOP_SetGlobal(PrimitivePtr *primitive, bool global) {
3870be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3871be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3872be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3873be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3874be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3875be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), global, value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3876be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3877be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3878be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3879be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3880be168c0dSopenharmony_ci+      free(*primitive);
3881be168c0dSopenharmony_ci+      *primitive = ret_value;
3882be168c0dSopenharmony_ci+    }
3883be168c0dSopenharmony_ci+  }
3884be168c0dSopenharmony_ci+}
3885be168c0dSopenharmony_ci+
3886be168c0dSopenharmony_ci+bool MindIR_GenOP_GetChannelShared(ConstPrimitivePtr primitive) {
3887be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3888be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3889be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3890be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3891be168c0dSopenharmony_ci+      return value->channel_shared();
3892be168c0dSopenharmony_ci+    } else {
3893be168c0dSopenharmony_ci+      return false;
3894be168c0dSopenharmony_ci+    }
3895be168c0dSopenharmony_ci+  } else {
3896be168c0dSopenharmony_ci+    return false;
3897be168c0dSopenharmony_ci+  }
3898be168c0dSopenharmony_ci+}
3899be168c0dSopenharmony_ci+
3900be168c0dSopenharmony_ci+void MindIR_GenOP_SetChannelShared(PrimitivePtr *primitive, bool channel_shared) {
3901be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3902be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3903be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3904be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3905be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3906be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), channel_shared, fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3907be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3908be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3909be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3910be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3911be168c0dSopenharmony_ci+      free(*primitive);
3912be168c0dSopenharmony_ci+      *primitive = ret_value;
3913be168c0dSopenharmony_ci+    }
3914be168c0dSopenharmony_ci+  }
3915be168c0dSopenharmony_ci+}
3916be168c0dSopenharmony_ci+
3917be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_GenOP_GetAxes(ConstPrimitivePtr primitive) {
3918be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3919be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3920be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3921be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3922be168c0dSopenharmony_ci+      std::vector<int64_t> result;
3923be168c0dSopenharmony_ci+      auto src = value->axes();
3924be168c0dSopenharmony_ci+      if (src == nullptr) {
3925be168c0dSopenharmony_ci+        return {};
3926be168c0dSopenharmony_ci+      }
3927be168c0dSopenharmony_ci+      result.resize(src->size());
3928be168c0dSopenharmony_ci+      std::transform(src->begin(), src->end(), result.begin(), [](int64_t item) { return item; });
3929be168c0dSopenharmony_ci+      return result;
3930be168c0dSopenharmony_ci+    } else {
3931be168c0dSopenharmony_ci+      return {};
3932be168c0dSopenharmony_ci+    }
3933be168c0dSopenharmony_ci+  } else {
3934be168c0dSopenharmony_ci+    return {};
3935be168c0dSopenharmony_ci+  }
3936be168c0dSopenharmony_ci+}
3937be168c0dSopenharmony_ci+
3938be168c0dSopenharmony_ci+void MindIR_GenOP_SetAxes(PrimitivePtr *primitive, const std::vector<int64_t> &axes) {
3939be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3940be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3941be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3942be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3943be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3944be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(axes.data(), axes.size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3945be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3946be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3947be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3948be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3949be168c0dSopenharmony_ci+      free(*primitive);
3950be168c0dSopenharmony_ci+      *primitive = ret_value;
3951be168c0dSopenharmony_ci+    }
3952be168c0dSopenharmony_ci+  }
3953be168c0dSopenharmony_ci+}
3954be168c0dSopenharmony_ci+
3955be168c0dSopenharmony_ci+bool MindIR_GenOP_GetKeepDims(ConstPrimitivePtr primitive) {
3956be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3957be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3958be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3959be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3960be168c0dSopenharmony_ci+      return value->keep_dims();
3961be168c0dSopenharmony_ci+    } else {
3962be168c0dSopenharmony_ci+      return false;
3963be168c0dSopenharmony_ci+    }
3964be168c0dSopenharmony_ci+  } else {
3965be168c0dSopenharmony_ci+    return false;
3966be168c0dSopenharmony_ci+  }
3967be168c0dSopenharmony_ci+}
3968be168c0dSopenharmony_ci+
3969be168c0dSopenharmony_ci+void MindIR_GenOP_SetKeepDims(PrimitivePtr *primitive, bool keep_dims) {
3970be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
3971be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
3972be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3973be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3974be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
3975be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), keep_dims, static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), value->coeff());
3976be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
3977be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
3978be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
3979be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
3980be168c0dSopenharmony_ci+      free(*primitive);
3981be168c0dSopenharmony_ci+      *primitive = ret_value;
3982be168c0dSopenharmony_ci+    }
3983be168c0dSopenharmony_ci+  }
3984be168c0dSopenharmony_ci+}
3985be168c0dSopenharmony_ci+
3986be168c0dSopenharmony_ci+ReduceMode MindIR_GenOP_GetReduceMode(ConstPrimitivePtr primitive) {
3987be168c0dSopenharmony_ci+  if (primitive != nullptr) {
3988be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
3989be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
3990be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
3991be168c0dSopenharmony_ci+      return static_cast<ReduceMode>(value->reduce_mode());
3992be168c0dSopenharmony_ci+    } else {
3993be168c0dSopenharmony_ci+      ReduceMode en = static_cast<ReduceMode>(0);
3994be168c0dSopenharmony_ci+      return en;
3995be168c0dSopenharmony_ci+    }
3996be168c0dSopenharmony_ci+  } else {
3997be168c0dSopenharmony_ci+    ReduceMode en = static_cast<ReduceMode>(0);
3998be168c0dSopenharmony_ci+    return en;
3999be168c0dSopenharmony_ci+  }
4000be168c0dSopenharmony_ci+}
4001be168c0dSopenharmony_ci+
4002be168c0dSopenharmony_ci+void MindIR_GenOP_SetReduceMode(PrimitivePtr *primitive, ReduceMode reduce_mode) {
4003be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4004be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4005be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
4006be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4007be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4008be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(reduce_mode), value->reduce_to_end(), value->coeff());
4009be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
4010be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4011be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4012be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4013be168c0dSopenharmony_ci+      free(*primitive);
4014be168c0dSopenharmony_ci+      *primitive = ret_value;
4015be168c0dSopenharmony_ci+    }
4016be168c0dSopenharmony_ci+  }
4017be168c0dSopenharmony_ci+}
4018be168c0dSopenharmony_ci+
4019be168c0dSopenharmony_ci+bool MindIR_GenOP_GetReduceToEnd(ConstPrimitivePtr primitive) {
4020be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4021be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4022be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
4023be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4024be168c0dSopenharmony_ci+      return value->reduce_to_end();
4025be168c0dSopenharmony_ci+    } else {
4026be168c0dSopenharmony_ci+      return false;
4027be168c0dSopenharmony_ci+    }
4028be168c0dSopenharmony_ci+  } else {
4029be168c0dSopenharmony_ci+    return false;
4030be168c0dSopenharmony_ci+  }
4031be168c0dSopenharmony_ci+}
4032be168c0dSopenharmony_ci+
4033be168c0dSopenharmony_ci+void MindIR_GenOP_SetReduceToEnd(PrimitivePtr *primitive, bool reduce_to_end) {
4034be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4035be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4036be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
4037be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4038be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4039be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), reduce_to_end, value->coeff());
4040be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
4041be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4042be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4043be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4044be168c0dSopenharmony_ci+      free(*primitive);
4045be168c0dSopenharmony_ci+      *primitive = ret_value;
4046be168c0dSopenharmony_ci+    }
4047be168c0dSopenharmony_ci+  }
4048be168c0dSopenharmony_ci+}
4049be168c0dSopenharmony_ci+
4050be168c0dSopenharmony_ci+float MindIR_GenOP_GetCoeff(ConstPrimitivePtr primitive) {
4051be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4052be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4053be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
4054be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4055be168c0dSopenharmony_ci+      return value->coeff();
4056be168c0dSopenharmony_ci+    } else {
4057be168c0dSopenharmony_ci+      return .0;
4058be168c0dSopenharmony_ci+    }
4059be168c0dSopenharmony_ci+  } else {
4060be168c0dSopenharmony_ci+    return .0;
4061be168c0dSopenharmony_ci+  }
4062be168c0dSopenharmony_ci+}
4063be168c0dSopenharmony_ci+
4064be168c0dSopenharmony_ci+void MindIR_GenOP_SetCoeff(PrimitivePtr *primitive, float coeff) {
4065be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4066be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4067be168c0dSopenharmony_ci+    auto value = prim->value_as_GenOP();
4068be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4069be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4070be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGenOP(fbb, static_cast<schema::ActivationType>(value->activation_type()), value->alpha(), value->min_val(), value->max_val(), value->is_training(), static_cast<schema::Format>(value->format()), fbb.CreateVector(value->kernel_size()->data(), value->kernel_size()->size()), fbb.CreateVector(value->stride()->data(), value->stride()->size()), fbb.CreateVector(value->dilation()->data(), value->dilation()->size()), static_cast<schema::PadMode>(value->pad_mode()), fbb.CreateVector(value->pad_list()->data(), value->pad_list()->size()), value->mode(), value->group(), value->in_channel(), value->out_channel(), static_cast<schema::EltwiseMode>(value->eltwise_mode()), value->has_bias(), value->use_axis(), value->axis(), value->epsilon(), value->momentum(), value->transpose_a(), value->transpose_b(), fbb.CreateVector(value->pad()->data(), value->pad()->size()), static_cast<schema::RoundMode>(value->round_mode()), value->global(), value->channel_shared(), fbb.CreateVector(value->axes()->data(), value->axes()->size()), value->keep_dims(), static_cast<schema::ReduceMode>(value->reduce_mode()), value->reduce_to_end(), coeff);
4071be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GEN_O_P), ops_offset.o);
4072be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4073be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4074be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4075be168c0dSopenharmony_ci+      free(*primitive);
4076be168c0dSopenharmony_ci+      *primitive = ret_value;
4077be168c0dSopenharmony_ci+    }
4078be168c0dSopenharmony_ci+  }
4079be168c0dSopenharmony_ci+}
4080be168c0dSopenharmony_ci+
4081be168c0dSopenharmony_ci+// ********** RaggedRange **********
4082be168c0dSopenharmony_ci+PrimitivePtr MindIR_RaggedRange_CreatePrimitive() {
4083be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
4084be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateRaggedRange(fbb);
4085be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_RAGGED_RANGE), ops_offset.o);
4086be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
4087be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4088be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4089be168c0dSopenharmony_ci+  return ret_value;
4090be168c0dSopenharmony_ci+}
4091be168c0dSopenharmony_ci+
4092be168c0dSopenharmony_ci+// ********** GLU **********
4093be168c0dSopenharmony_ci+PrimitivePtr MindIR_GLU_CreatePrimitive(int64_t axis) {
4094be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
4095be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateGLU(fbb, axis);
4096be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_G_L_U), ops_offset.o);
4097be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
4098be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4099be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4100be168c0dSopenharmony_ci+  return ret_value;
4101be168c0dSopenharmony_ci+}
4102be168c0dSopenharmony_ci+
4103be168c0dSopenharmony_ci+int64_t MindIR_GLU_GetAxis(ConstPrimitivePtr primitive) {
4104be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4105be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4106be168c0dSopenharmony_ci+    auto value = prim->value_as_GLU();
4107be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4108be168c0dSopenharmony_ci+      return value->axis();
4109be168c0dSopenharmony_ci+    } else {
4110be168c0dSopenharmony_ci+      return 0;
4111be168c0dSopenharmony_ci+    }
4112be168c0dSopenharmony_ci+  } else {
4113be168c0dSopenharmony_ci+    return 0;
4114be168c0dSopenharmony_ci+  }
4115be168c0dSopenharmony_ci+}
4116be168c0dSopenharmony_ci+
4117be168c0dSopenharmony_ci+void MindIR_GLU_SetAxis(PrimitivePtr *primitive, int64_t axis) {
4118be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4119be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4120be168c0dSopenharmony_ci+    auto value = prim->value_as_GLU();
4121be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4122be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4123be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGLU(fbb, axis);
4124be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_G_L_U), ops_offset.o);
4125be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4126be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4127be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4128be168c0dSopenharmony_ci+      free(*primitive);
4129be168c0dSopenharmony_ci+      *primitive = ret_value;
4130be168c0dSopenharmony_ci+    }
4131be168c0dSopenharmony_ci+  }
4132be168c0dSopenharmony_ci+}
4133be168c0dSopenharmony_ci+
4134be168c0dSopenharmony_ci+// ********** Affine **********
4135be168c0dSopenharmony_ci+PrimitivePtr MindIR_Affine_CreatePrimitive(const std::vector<int64_t> &context, int64_t output_dim, ActivationType activation_type, bool transpose_a, bool transpose_b) {
4136be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
4137be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateAffine(fbb, fbb.CreateVector(context.data(), context.size()), output_dim, static_cast<schema::ActivationType>(activation_type), transpose_a, transpose_b);
4138be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_AFFINE), ops_offset.o);
4139be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
4140be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4141be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4142be168c0dSopenharmony_ci+  return ret_value;
4143be168c0dSopenharmony_ci+}
4144be168c0dSopenharmony_ci+
4145be168c0dSopenharmony_ci+std::vector<int64_t> MindIR_Affine_GetContext(ConstPrimitivePtr primitive) {
4146be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4147be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4148be168c0dSopenharmony_ci+    auto value = prim->value_as_Affine();
4149be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4150be168c0dSopenharmony_ci+      std::vector<int64_t> result;
4151be168c0dSopenharmony_ci+      auto src = value->context();
4152be168c0dSopenharmony_ci+      if (src == nullptr) {
4153be168c0dSopenharmony_ci+        return {};
4154be168c0dSopenharmony_ci+      }
4155be168c0dSopenharmony_ci+      result.resize(src->size());
4156be168c0dSopenharmony_ci+      std::transform(src->begin(), src->end(), result.begin(), [](int64_t item) { return item; });
4157be168c0dSopenharmony_ci+      return result;
4158be168c0dSopenharmony_ci+    } else {
4159be168c0dSopenharmony_ci+      return {};
4160be168c0dSopenharmony_ci+    }
4161be168c0dSopenharmony_ci+  } else {
4162be168c0dSopenharmony_ci+    return {};
4163be168c0dSopenharmony_ci+  }
4164be168c0dSopenharmony_ci+}
4165be168c0dSopenharmony_ci+
4166be168c0dSopenharmony_ci+void MindIR_Affine_SetContext(PrimitivePtr *primitive, const std::vector<int64_t> &context) {
4167be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4168be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4169be168c0dSopenharmony_ci+    auto value = prim->value_as_Affine();
4170be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4171be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4172be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateAffine(fbb, fbb.CreateVector(context.data(), context.size()), value->output_dim(), static_cast<schema::ActivationType>(value->activation_type()), value->transpose_a(), value->transpose_b());
4173be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_AFFINE), ops_offset.o);
4174be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4175be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4176be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4177be168c0dSopenharmony_ci+      free(*primitive);
4178be168c0dSopenharmony_ci+      *primitive = ret_value;
4179be168c0dSopenharmony_ci+    }
4180be168c0dSopenharmony_ci+  }
4181be168c0dSopenharmony_ci+}
4182be168c0dSopenharmony_ci+
4183be168c0dSopenharmony_ci+int64_t MindIR_Affine_GetOutputDim(ConstPrimitivePtr primitive) {
4184be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4185be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4186be168c0dSopenharmony_ci+    auto value = prim->value_as_Affine();
4187be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4188be168c0dSopenharmony_ci+      return value->output_dim();
4189be168c0dSopenharmony_ci+    } else {
4190be168c0dSopenharmony_ci+      return 0;
4191be168c0dSopenharmony_ci+    }
4192be168c0dSopenharmony_ci+  } else {
4193be168c0dSopenharmony_ci+    return 0;
4194be168c0dSopenharmony_ci+  }
4195be168c0dSopenharmony_ci+}
4196be168c0dSopenharmony_ci+
4197be168c0dSopenharmony_ci+void MindIR_Affine_SetOutputDim(PrimitivePtr *primitive, int64_t output_dim) {
4198be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4199be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4200be168c0dSopenharmony_ci+    auto value = prim->value_as_Affine();
4201be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4202be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4203be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateAffine(fbb, fbb.CreateVector(value->context()->data(), value->context()->size()), output_dim, static_cast<schema::ActivationType>(value->activation_type()), value->transpose_a(), value->transpose_b());
4204be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_AFFINE), ops_offset.o);
4205be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4206be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4207be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4208be168c0dSopenharmony_ci+      free(*primitive);
4209be168c0dSopenharmony_ci+      *primitive = ret_value;
4210be168c0dSopenharmony_ci+    }
4211be168c0dSopenharmony_ci+  }
4212be168c0dSopenharmony_ci+}
4213be168c0dSopenharmony_ci+
4214be168c0dSopenharmony_ci+ActivationType MindIR_Affine_GetActivationType(ConstPrimitivePtr primitive) {
4215be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4216be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4217be168c0dSopenharmony_ci+    auto value = prim->value_as_Affine();
4218be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4219be168c0dSopenharmony_ci+      return static_cast<ActivationType>(value->activation_type());
4220be168c0dSopenharmony_ci+    } else {
4221be168c0dSopenharmony_ci+      ActivationType en = static_cast<ActivationType>(0);
4222be168c0dSopenharmony_ci+      return en;
4223be168c0dSopenharmony_ci+    }
4224be168c0dSopenharmony_ci+  } else {
4225be168c0dSopenharmony_ci+    ActivationType en = static_cast<ActivationType>(0);
4226be168c0dSopenharmony_ci+    return en;
4227be168c0dSopenharmony_ci+  }
4228be168c0dSopenharmony_ci+}
4229be168c0dSopenharmony_ci+
4230be168c0dSopenharmony_ci+void MindIR_Affine_SetActivationType(PrimitivePtr *primitive, ActivationType activation_type) {
4231be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4232be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4233be168c0dSopenharmony_ci+    auto value = prim->value_as_Affine();
4234be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4235be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4236be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateAffine(fbb, fbb.CreateVector(value->context()->data(), value->context()->size()), value->output_dim(), static_cast<schema::ActivationType>(activation_type), value->transpose_a(), value->transpose_b());
4237be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_AFFINE), ops_offset.o);
4238be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4239be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4240be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4241be168c0dSopenharmony_ci+      free(*primitive);
4242be168c0dSopenharmony_ci+      *primitive = ret_value;
4243be168c0dSopenharmony_ci+    }
4244be168c0dSopenharmony_ci+  }
4245be168c0dSopenharmony_ci+}
4246be168c0dSopenharmony_ci+
4247be168c0dSopenharmony_ci+bool MindIR_Affine_GetTransposeA(ConstPrimitivePtr primitive) {
4248be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4249be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4250be168c0dSopenharmony_ci+    auto value = prim->value_as_Affine();
4251be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4252be168c0dSopenharmony_ci+      return value->transpose_a();
4253be168c0dSopenharmony_ci+    } else {
4254be168c0dSopenharmony_ci+      return false;
4255be168c0dSopenharmony_ci+    }
4256be168c0dSopenharmony_ci+  } else {
4257be168c0dSopenharmony_ci+    return false;
4258be168c0dSopenharmony_ci+  }
4259be168c0dSopenharmony_ci+}
4260be168c0dSopenharmony_ci+
4261be168c0dSopenharmony_ci+void MindIR_Affine_SetTransposeA(PrimitivePtr *primitive, bool transpose_a) {
4262be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4263be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4264be168c0dSopenharmony_ci+    auto value = prim->value_as_Affine();
4265be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4266be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4267be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateAffine(fbb, fbb.CreateVector(value->context()->data(), value->context()->size()), value->output_dim(), static_cast<schema::ActivationType>(value->activation_type()), transpose_a, value->transpose_b());
4268be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_AFFINE), ops_offset.o);
4269be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4270be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4271be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4272be168c0dSopenharmony_ci+      free(*primitive);
4273be168c0dSopenharmony_ci+      *primitive = ret_value;
4274be168c0dSopenharmony_ci+    }
4275be168c0dSopenharmony_ci+  }
4276be168c0dSopenharmony_ci+}
4277be168c0dSopenharmony_ci+
4278be168c0dSopenharmony_ci+bool MindIR_Affine_GetTransposeB(ConstPrimitivePtr primitive) {
4279be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4280be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4281be168c0dSopenharmony_ci+    auto value = prim->value_as_Affine();
4282be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4283be168c0dSopenharmony_ci+      return value->transpose_b();
4284be168c0dSopenharmony_ci+    } else {
4285be168c0dSopenharmony_ci+      return false;
4286be168c0dSopenharmony_ci+    }
4287be168c0dSopenharmony_ci+  } else {
4288be168c0dSopenharmony_ci+    return false;
4289be168c0dSopenharmony_ci+  }
4290be168c0dSopenharmony_ci+}
4291be168c0dSopenharmony_ci+
4292be168c0dSopenharmony_ci+void MindIR_Affine_SetTransposeB(PrimitivePtr *primitive, bool transpose_b) {
4293be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4294be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4295be168c0dSopenharmony_ci+    auto value = prim->value_as_Affine();
4296be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4297be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4298be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateAffine(fbb, fbb.CreateVector(value->context()->data(), value->context()->size()), value->output_dim(), static_cast<schema::ActivationType>(value->activation_type()), value->transpose_a(), transpose_b);
4299be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_AFFINE), ops_offset.o);
4300be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4301be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4302be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4303be168c0dSopenharmony_ci+      free(*primitive);
4304be168c0dSopenharmony_ci+      *primitive = ret_value;
4305be168c0dSopenharmony_ci+    }
4306be168c0dSopenharmony_ci+  }
4307be168c0dSopenharmony_ci+}
4308be168c0dSopenharmony_ci+
4309be168c0dSopenharmony_ci+// ********** AllGather **********
4310be168c0dSopenharmony_ci+PrimitivePtr MindIR_AllGather_CreatePrimitive(const std::string &group, int32_t rank_size) {
4311be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
4312be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateAllGather(fbb, fbb.CreateString(group), rank_size);
4313be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_ALL_GATHER), ops_offset.o);
4314be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
4315be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4316be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4317be168c0dSopenharmony_ci+  return ret_value;
4318be168c0dSopenharmony_ci+}
4319be168c0dSopenharmony_ci+
4320be168c0dSopenharmony_ci+std::string MindIR_AllGather_GetGroup(ConstPrimitivePtr primitive) {
4321be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4322be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4323be168c0dSopenharmony_ci+    auto value = prim->value_as_AllGather();
4324be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4325be168c0dSopenharmony_ci+      return std::string(value->group()->c_str(),value->group()->size());
4326be168c0dSopenharmony_ci+    } else {
4327be168c0dSopenharmony_ci+      return "";
4328be168c0dSopenharmony_ci+    }
4329be168c0dSopenharmony_ci+  } else {
4330be168c0dSopenharmony_ci+    return "";
4331be168c0dSopenharmony_ci+  }
4332be168c0dSopenharmony_ci+}
4333be168c0dSopenharmony_ci+
4334be168c0dSopenharmony_ci+void MindIR_AllGather_SetGroup(PrimitivePtr *primitive, const std::string &group) {
4335be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4336be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4337be168c0dSopenharmony_ci+    auto value = prim->value_as_AllGather();
4338be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4339be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4340be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateAllGather(fbb, fbb.CreateString(group), value->rank_size());
4341be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_ALL_GATHER), ops_offset.o);
4342be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4343be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4344be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4345be168c0dSopenharmony_ci+      free(*primitive);
4346be168c0dSopenharmony_ci+      *primitive = ret_value;
4347be168c0dSopenharmony_ci+    }
4348be168c0dSopenharmony_ci+  }
4349be168c0dSopenharmony_ci+}
4350be168c0dSopenharmony_ci+
4351be168c0dSopenharmony_ci+int32_t MindIR_AllGather_GetRankSize(ConstPrimitivePtr primitive) {
4352be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4353be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4354be168c0dSopenharmony_ci+    auto value = prim->value_as_AllGather();
4355be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4356be168c0dSopenharmony_ci+      return value->rank_size();
4357be168c0dSopenharmony_ci+    } else {
4358be168c0dSopenharmony_ci+      return 0;
4359be168c0dSopenharmony_ci+    }
4360be168c0dSopenharmony_ci+  } else {
4361be168c0dSopenharmony_ci+    return 0;
4362be168c0dSopenharmony_ci+  }
4363be168c0dSopenharmony_ci+}
4364be168c0dSopenharmony_ci+
4365be168c0dSopenharmony_ci+void MindIR_AllGather_SetRankSize(PrimitivePtr *primitive, int32_t rank_size) {
4366be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4367be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4368be168c0dSopenharmony_ci+    auto value = prim->value_as_AllGather();
4369be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4370be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4371be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateAllGather(fbb, fbb.CreateString(std::string(value->group()->c_str(), value->group()->size())), rank_size);
4372be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_ALL_GATHER), ops_offset.o);
4373be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4374be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4375be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4376be168c0dSopenharmony_ci+      free(*primitive);
4377be168c0dSopenharmony_ci+      *primitive = ret_value;
4378be168c0dSopenharmony_ci+    }
4379be168c0dSopenharmony_ci+  }
4380be168c0dSopenharmony_ci+}
4381be168c0dSopenharmony_ci+
4382be168c0dSopenharmony_ci+// ********** ReduceScatter **********
4383be168c0dSopenharmony_ci+PrimitivePtr MindIR_ReduceScatter_CreatePrimitive(const std::string &group, ReduceMode mode, int32_t rank_size) {
4384be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
4385be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateReduceScatter(fbb, fbb.CreateString(group), static_cast<schema::ReduceMode>(mode), rank_size);
4386be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_REDUCE_SCATTER), ops_offset.o);
4387be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
4388be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4389be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4390be168c0dSopenharmony_ci+  return ret_value;
4391be168c0dSopenharmony_ci+}
4392be168c0dSopenharmony_ci+
4393be168c0dSopenharmony_ci+std::string MindIR_ReduceScatter_GetGroup(ConstPrimitivePtr primitive) {
4394be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4395be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4396be168c0dSopenharmony_ci+    auto value = prim->value_as_ReduceScatter();
4397be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4398be168c0dSopenharmony_ci+      return std::string(value->group()->c_str(),value->group()->size());
4399be168c0dSopenharmony_ci+    } else {
4400be168c0dSopenharmony_ci+      return "";
4401be168c0dSopenharmony_ci+    }
4402be168c0dSopenharmony_ci+  } else {
4403be168c0dSopenharmony_ci+    return "";
4404be168c0dSopenharmony_ci+  }
4405be168c0dSopenharmony_ci+}
4406be168c0dSopenharmony_ci+
4407be168c0dSopenharmony_ci+void MindIR_ReduceScatter_SetGroup(PrimitivePtr *primitive, const std::string &group) {
4408be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4409be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4410be168c0dSopenharmony_ci+    auto value = prim->value_as_ReduceScatter();
4411be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4412be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4413be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateReduceScatter(fbb, fbb.CreateString(group), static_cast<schema::ReduceMode>(value->mode()), value->rank_size());
4414be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_REDUCE_SCATTER), ops_offset.o);
4415be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4416be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4417be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4418be168c0dSopenharmony_ci+      free(*primitive);
4419be168c0dSopenharmony_ci+      *primitive = ret_value;
4420be168c0dSopenharmony_ci+    }
4421be168c0dSopenharmony_ci+  }
4422be168c0dSopenharmony_ci+}
4423be168c0dSopenharmony_ci+
4424be168c0dSopenharmony_ci+ReduceMode MindIR_ReduceScatter_GetMode(ConstPrimitivePtr primitive) {
4425be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4426be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4427be168c0dSopenharmony_ci+    auto value = prim->value_as_ReduceScatter();
4428be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4429be168c0dSopenharmony_ci+      return static_cast<ReduceMode>(value->mode());
4430be168c0dSopenharmony_ci+    } else {
4431be168c0dSopenharmony_ci+      ReduceMode en = static_cast<ReduceMode>(0);
4432be168c0dSopenharmony_ci+      return en;
4433be168c0dSopenharmony_ci+    }
4434be168c0dSopenharmony_ci+  } else {
4435be168c0dSopenharmony_ci+    ReduceMode en = static_cast<ReduceMode>(0);
4436be168c0dSopenharmony_ci+    return en;
4437be168c0dSopenharmony_ci+  }
4438be168c0dSopenharmony_ci+}
4439be168c0dSopenharmony_ci+
4440be168c0dSopenharmony_ci+void MindIR_ReduceScatter_SetMode(PrimitivePtr *primitive, ReduceMode mode) {
4441be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4442be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4443be168c0dSopenharmony_ci+    auto value = prim->value_as_ReduceScatter();
4444be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4445be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4446be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateReduceScatter(fbb, fbb.CreateString(std::string(value->group()->c_str(), value->group()->size())), static_cast<schema::ReduceMode>(mode), value->rank_size());
4447be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_REDUCE_SCATTER), ops_offset.o);
4448be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4449be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4450be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4451be168c0dSopenharmony_ci+      free(*primitive);
4452be168c0dSopenharmony_ci+      *primitive = ret_value;
4453be168c0dSopenharmony_ci+    }
4454be168c0dSopenharmony_ci+  }
4455be168c0dSopenharmony_ci+}
4456be168c0dSopenharmony_ci+
4457be168c0dSopenharmony_ci+int32_t MindIR_ReduceScatter_GetRankSize(ConstPrimitivePtr primitive) {
4458be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4459be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4460be168c0dSopenharmony_ci+    auto value = prim->value_as_ReduceScatter();
4461be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4462be168c0dSopenharmony_ci+      return value->rank_size();
4463be168c0dSopenharmony_ci+    } else {
4464be168c0dSopenharmony_ci+      return 0;
4465be168c0dSopenharmony_ci+    }
4466be168c0dSopenharmony_ci+  } else {
4467be168c0dSopenharmony_ci+    return 0;
4468be168c0dSopenharmony_ci+  }
4469be168c0dSopenharmony_ci+}
4470be168c0dSopenharmony_ci+
4471be168c0dSopenharmony_ci+void MindIR_ReduceScatter_SetRankSize(PrimitivePtr *primitive, int32_t rank_size) {
4472be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4473be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4474be168c0dSopenharmony_ci+    auto value = prim->value_as_ReduceScatter();
4475be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4476be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4477be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateReduceScatter(fbb, fbb.CreateString(std::string(value->group()->c_str(), value->group()->size())), static_cast<schema::ReduceMode>(value->mode()), rank_size);
4478be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_REDUCE_SCATTER), ops_offset.o);
4479be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4480be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4481be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4482be168c0dSopenharmony_ci+      free(*primitive);
4483be168c0dSopenharmony_ci+      *primitive = ret_value;
4484be168c0dSopenharmony_ci+    }
4485be168c0dSopenharmony_ci+  }
4486be168c0dSopenharmony_ci+}
4487be168c0dSopenharmony_ci+
4488be168c0dSopenharmony_ci+// ********** DynamicQuant **********
4489be168c0dSopenharmony_ci+PrimitivePtr MindIR_DynamicQuant_CreatePrimitive(bool symmetric, int64_t dst_type) {
4490be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
4491be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateDynamicQuant(fbb, symmetric, dst_type);
4492be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_DYNAMIC_QUANT), ops_offset.o);
4493be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
4494be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4495be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4496be168c0dSopenharmony_ci+  return ret_value;
4497be168c0dSopenharmony_ci+}
4498be168c0dSopenharmony_ci+
4499be168c0dSopenharmony_ci+bool MindIR_DynamicQuant_GetSymmetric(ConstPrimitivePtr primitive) {
4500be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4501be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4502be168c0dSopenharmony_ci+    auto value = prim->value_as_DynamicQuant();
4503be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4504be168c0dSopenharmony_ci+      return value->symmetric();
4505be168c0dSopenharmony_ci+    } else {
4506be168c0dSopenharmony_ci+      return false;
4507be168c0dSopenharmony_ci+    }
4508be168c0dSopenharmony_ci+  } else {
4509be168c0dSopenharmony_ci+    return false;
4510be168c0dSopenharmony_ci+  }
4511be168c0dSopenharmony_ci+}
4512be168c0dSopenharmony_ci+
4513be168c0dSopenharmony_ci+void MindIR_DynamicQuant_SetSymmetric(PrimitivePtr *primitive, bool symmetric) {
4514be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4515be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4516be168c0dSopenharmony_ci+    auto value = prim->value_as_DynamicQuant();
4517be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4518be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4519be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateDynamicQuant(fbb, symmetric, value->dst_type());
4520be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_DYNAMIC_QUANT), ops_offset.o);
4521be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4522be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4523be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4524be168c0dSopenharmony_ci+      free(*primitive);
4525be168c0dSopenharmony_ci+      *primitive = ret_value;
4526be168c0dSopenharmony_ci+    }
4527be168c0dSopenharmony_ci+  }
4528be168c0dSopenharmony_ci+}
4529be168c0dSopenharmony_ci+
4530be168c0dSopenharmony_ci+int64_t MindIR_DynamicQuant_GetDstType(ConstPrimitivePtr primitive) {
4531be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4532be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4533be168c0dSopenharmony_ci+    auto value = prim->value_as_DynamicQuant();
4534be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4535be168c0dSopenharmony_ci+      return value->dst_type();
4536be168c0dSopenharmony_ci+    } else {
4537be168c0dSopenharmony_ci+      return 0;
4538be168c0dSopenharmony_ci+    }
4539be168c0dSopenharmony_ci+  } else {
4540be168c0dSopenharmony_ci+    return 0;
4541be168c0dSopenharmony_ci+  }
4542be168c0dSopenharmony_ci+}
4543be168c0dSopenharmony_ci+
4544be168c0dSopenharmony_ci+void MindIR_DynamicQuant_SetDstType(PrimitivePtr *primitive, int64_t dst_type) {
4545be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4546be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4547be168c0dSopenharmony_ci+    auto value = prim->value_as_DynamicQuant();
4548be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4549be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4550be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateDynamicQuant(fbb, value->symmetric(), dst_type);
4551be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_DYNAMIC_QUANT), ops_offset.o);
4552be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4553be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4554be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4555be168c0dSopenharmony_ci+      free(*primitive);
4556be168c0dSopenharmony_ci+      *primitive = ret_value;
4557be168c0dSopenharmony_ci+    }
4558be168c0dSopenharmony_ci+  }
4559be168c0dSopenharmony_ci+}
4560be168c0dSopenharmony_ci+
4561be168c0dSopenharmony_ci+// ********** RandomNormal **********
4562be168c0dSopenharmony_ci+PrimitivePtr MindIR_RandomNormal_CreatePrimitive(float seed, float mean, float scale) {
4563be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
4564be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateRandomNormal(fbb, seed, mean, scale);
4565be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_RANDOM_NORMAL), ops_offset.o);
4566be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
4567be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4568be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4569be168c0dSopenharmony_ci+  return ret_value;
4570be168c0dSopenharmony_ci+}
4571be168c0dSopenharmony_ci+
4572be168c0dSopenharmony_ci+float MindIR_RandomNormal_GetSeed(ConstPrimitivePtr primitive) {
4573be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4574be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4575be168c0dSopenharmony_ci+    auto value = prim->value_as_RandomNormal();
4576be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4577be168c0dSopenharmony_ci+      return value->seed();
4578be168c0dSopenharmony_ci+    } else {
4579be168c0dSopenharmony_ci+      return .0;
4580be168c0dSopenharmony_ci+    }
4581be168c0dSopenharmony_ci+  } else {
4582be168c0dSopenharmony_ci+    return .0;
4583be168c0dSopenharmony_ci+  }
4584be168c0dSopenharmony_ci+}
4585be168c0dSopenharmony_ci+
4586be168c0dSopenharmony_ci+void MindIR_RandomNormal_SetSeed(PrimitivePtr *primitive, float seed) {
4587be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4588be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4589be168c0dSopenharmony_ci+    auto value = prim->value_as_RandomNormal();
4590be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4591be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4592be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateRandomNormal(fbb, seed, value->mean(), value->scale());
4593be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_RANDOM_NORMAL), ops_offset.o);
4594be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4595be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4596be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4597be168c0dSopenharmony_ci+      free(*primitive);
4598be168c0dSopenharmony_ci+      *primitive = ret_value;
4599be168c0dSopenharmony_ci+    }
4600be168c0dSopenharmony_ci+  }
4601be168c0dSopenharmony_ci+}
4602be168c0dSopenharmony_ci+
4603be168c0dSopenharmony_ci+float MindIR_RandomNormal_GetMean(ConstPrimitivePtr primitive) {
4604be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4605be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4606be168c0dSopenharmony_ci+    auto value = prim->value_as_RandomNormal();
4607be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4608be168c0dSopenharmony_ci+      return value->mean();
4609be168c0dSopenharmony_ci+    } else {
4610be168c0dSopenharmony_ci+      return .0;
4611be168c0dSopenharmony_ci+    }
4612be168c0dSopenharmony_ci+  } else {
4613be168c0dSopenharmony_ci+    return .0;
4614be168c0dSopenharmony_ci+  }
4615be168c0dSopenharmony_ci+}
4616be168c0dSopenharmony_ci+
4617be168c0dSopenharmony_ci+void MindIR_RandomNormal_SetMean(PrimitivePtr *primitive, float mean) {
4618be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4619be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4620be168c0dSopenharmony_ci+    auto value = prim->value_as_RandomNormal();
4621be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4622be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4623be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateRandomNormal(fbb, value->seed(), mean, value->scale());
4624be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_RANDOM_NORMAL), ops_offset.o);
4625be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4626be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4627be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4628be168c0dSopenharmony_ci+      free(*primitive);
4629be168c0dSopenharmony_ci+      *primitive = ret_value;
4630be168c0dSopenharmony_ci+    }
4631be168c0dSopenharmony_ci+  }
4632be168c0dSopenharmony_ci+}
4633be168c0dSopenharmony_ci+
4634be168c0dSopenharmony_ci+float MindIR_RandomNormal_GetScale(ConstPrimitivePtr primitive) {
4635be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4636be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4637be168c0dSopenharmony_ci+    auto value = prim->value_as_RandomNormal();
4638be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4639be168c0dSopenharmony_ci+      return value->scale();
4640be168c0dSopenharmony_ci+    } else {
4641be168c0dSopenharmony_ci+      return .0;
4642be168c0dSopenharmony_ci+    }
4643be168c0dSopenharmony_ci+  } else {
4644be168c0dSopenharmony_ci+    return .0;
4645be168c0dSopenharmony_ci+  }
4646be168c0dSopenharmony_ci+}
4647be168c0dSopenharmony_ci+
4648be168c0dSopenharmony_ci+void MindIR_RandomNormal_SetScale(PrimitivePtr *primitive, float scale) {
4649be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4650be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4651be168c0dSopenharmony_ci+    auto value = prim->value_as_RandomNormal();
4652be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4653be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4654be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateRandomNormal(fbb, value->seed(), value->mean(), scale);
4655be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_RANDOM_NORMAL), ops_offset.o);
4656be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4657be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4658be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4659be168c0dSopenharmony_ci+      free(*primitive);
4660be168c0dSopenharmony_ci+      *primitive = ret_value;
4661be168c0dSopenharmony_ci+    }
4662be168c0dSopenharmony_ci+  }
4663be168c0dSopenharmony_ci+}
4664be168c0dSopenharmony_ci+
4665be168c0dSopenharmony_ci+// ********** FormatTranspose **********
4666be168c0dSopenharmony_ci+PrimitivePtr MindIR_FormatTranspose_CreatePrimitive(Format src_format, Format dst_format) {
4667be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
4668be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateFormatTranspose(fbb, static_cast<schema::Format>(src_format), static_cast<schema::Format>(dst_format));
4669be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_FORMAT_TRANSPOSE), ops_offset.o);
4670be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
4671be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4672be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4673be168c0dSopenharmony_ci+  return ret_value;
4674be168c0dSopenharmony_ci+}
4675be168c0dSopenharmony_ci+
4676be168c0dSopenharmony_ci+Format MindIR_FormatTranspose_GetSrcFormat(ConstPrimitivePtr primitive) {
4677be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4678be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4679be168c0dSopenharmony_ci+    auto value = prim->value_as_FormatTranspose();
4680be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4681be168c0dSopenharmony_ci+      return static_cast<Format>(value->src_format());
4682be168c0dSopenharmony_ci+    } else {
4683be168c0dSopenharmony_ci+      Format en = static_cast<Format>(0);
4684be168c0dSopenharmony_ci+      return en;
4685be168c0dSopenharmony_ci+    }
4686be168c0dSopenharmony_ci+  } else {
4687be168c0dSopenharmony_ci+    Format en = static_cast<Format>(0);
4688be168c0dSopenharmony_ci+    return en;
4689be168c0dSopenharmony_ci+  }
4690be168c0dSopenharmony_ci+}
4691be168c0dSopenharmony_ci+
4692be168c0dSopenharmony_ci+void MindIR_FormatTranspose_SetSrcFormat(PrimitivePtr *primitive, Format src_format) {
4693be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4694be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4695be168c0dSopenharmony_ci+    auto value = prim->value_as_FormatTranspose();
4696be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4697be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4698be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateFormatTranspose(fbb, static_cast<schema::Format>(src_format), static_cast<schema::Format>(value->dst_format()));
4699be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_FORMAT_TRANSPOSE), ops_offset.o);
4700be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4701be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4702be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4703be168c0dSopenharmony_ci+      free(*primitive);
4704be168c0dSopenharmony_ci+      *primitive = ret_value;
4705be168c0dSopenharmony_ci+    }
4706be168c0dSopenharmony_ci+  }
4707be168c0dSopenharmony_ci+}
4708be168c0dSopenharmony_ci+
4709be168c0dSopenharmony_ci+Format MindIR_FormatTranspose_GetDstFormat(ConstPrimitivePtr primitive) {
4710be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4711be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4712be168c0dSopenharmony_ci+    auto value = prim->value_as_FormatTranspose();
4713be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4714be168c0dSopenharmony_ci+      return static_cast<Format>(value->dst_format());
4715be168c0dSopenharmony_ci+    } else {
4716be168c0dSopenharmony_ci+      Format en = static_cast<Format>(0);
4717be168c0dSopenharmony_ci+      return en;
4718be168c0dSopenharmony_ci+    }
4719be168c0dSopenharmony_ci+  } else {
4720be168c0dSopenharmony_ci+    Format en = static_cast<Format>(0);
4721be168c0dSopenharmony_ci+    return en;
4722be168c0dSopenharmony_ci+  }
4723be168c0dSopenharmony_ci+}
4724be168c0dSopenharmony_ci+
4725be168c0dSopenharmony_ci+void MindIR_FormatTranspose_SetDstFormat(PrimitivePtr *primitive, Format dst_format) {
4726be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4727be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4728be168c0dSopenharmony_ci+    auto value = prim->value_as_FormatTranspose();
4729be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4730be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4731be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateFormatTranspose(fbb, static_cast<schema::Format>(value->src_format()), static_cast<schema::Format>(dst_format));
4732be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_FORMAT_TRANSPOSE), ops_offset.o);
4733be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4734be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4735be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4736be168c0dSopenharmony_ci+      free(*primitive);
4737be168c0dSopenharmony_ci+      *primitive = ret_value;
4738be168c0dSopenharmony_ci+    }
4739be168c0dSopenharmony_ci+  }
4740be168c0dSopenharmony_ci+}
4741be168c0dSopenharmony_ci+
4742be168c0dSopenharmony_ci+// ********** GatherD **********
4743be168c0dSopenharmony_ci+PrimitivePtr MindIR_GatherD_CreatePrimitive() {
4744be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
4745be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateGatherD(fbb);
4746be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GATHER_D), ops_offset.o);
4747be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
4748be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4749be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4750be168c0dSopenharmony_ci+  return ret_value;
4751be168c0dSopenharmony_ci+}
4752be168c0dSopenharmony_ci+
4753be168c0dSopenharmony_ci+// ********** GroupNormFusion **********
4754be168c0dSopenharmony_ci+PrimitivePtr MindIR_GroupNormFusion_CreatePrimitive(int64_t num_groups, float epsilon, bool affine) {
4755be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
4756be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateGroupNormFusion(fbb, num_groups, epsilon, affine);
4757be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GROUP_NORM_FUSION), ops_offset.o);
4758be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
4759be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4760be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4761be168c0dSopenharmony_ci+  return ret_value;
4762be168c0dSopenharmony_ci+}
4763be168c0dSopenharmony_ci+
4764be168c0dSopenharmony_ci+int64_t MindIR_GroupNormFusion_GetNumGroups(ConstPrimitivePtr primitive) {
4765be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4766be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4767be168c0dSopenharmony_ci+    auto value = prim->value_as_GroupNormFusion();
4768be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4769be168c0dSopenharmony_ci+      return value->num_groups();
4770be168c0dSopenharmony_ci+    } else {
4771be168c0dSopenharmony_ci+      return 0;
4772be168c0dSopenharmony_ci+    }
4773be168c0dSopenharmony_ci+  } else {
4774be168c0dSopenharmony_ci+    return 0;
4775be168c0dSopenharmony_ci+  }
4776be168c0dSopenharmony_ci+}
4777be168c0dSopenharmony_ci+
4778be168c0dSopenharmony_ci+void MindIR_GroupNormFusion_SetNumGroups(PrimitivePtr *primitive, int64_t num_groups) {
4779be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4780be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4781be168c0dSopenharmony_ci+    auto value = prim->value_as_GroupNormFusion();
4782be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4783be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4784be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGroupNormFusion(fbb, num_groups, value->epsilon(), value->affine());
4785be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GROUP_NORM_FUSION), ops_offset.o);
4786be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4787be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4788be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4789be168c0dSopenharmony_ci+      free(*primitive);
4790be168c0dSopenharmony_ci+      *primitive = ret_value;
4791be168c0dSopenharmony_ci+    }
4792be168c0dSopenharmony_ci+  }
4793be168c0dSopenharmony_ci+}
4794be168c0dSopenharmony_ci+
4795be168c0dSopenharmony_ci+float MindIR_GroupNormFusion_GetEpsilon(ConstPrimitivePtr primitive) {
4796be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4797be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4798be168c0dSopenharmony_ci+    auto value = prim->value_as_GroupNormFusion();
4799be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4800be168c0dSopenharmony_ci+      return value->epsilon();
4801be168c0dSopenharmony_ci+    } else {
4802be168c0dSopenharmony_ci+      return .0;
4803be168c0dSopenharmony_ci+    }
4804be168c0dSopenharmony_ci+  } else {
4805be168c0dSopenharmony_ci+    return .0;
4806be168c0dSopenharmony_ci+  }
4807be168c0dSopenharmony_ci+}
4808be168c0dSopenharmony_ci+
4809be168c0dSopenharmony_ci+void MindIR_GroupNormFusion_SetEpsilon(PrimitivePtr *primitive, float epsilon) {
4810be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4811be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4812be168c0dSopenharmony_ci+    auto value = prim->value_as_GroupNormFusion();
4813be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4814be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4815be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGroupNormFusion(fbb, value->num_groups(), epsilon, value->affine());
4816be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GROUP_NORM_FUSION), ops_offset.o);
4817be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4818be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4819be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4820be168c0dSopenharmony_ci+      free(*primitive);
4821be168c0dSopenharmony_ci+      *primitive = ret_value;
4822be168c0dSopenharmony_ci+    }
4823be168c0dSopenharmony_ci+  }
4824be168c0dSopenharmony_ci+}
4825be168c0dSopenharmony_ci+
4826be168c0dSopenharmony_ci+bool MindIR_GroupNormFusion_GetAffine(ConstPrimitivePtr primitive) {
4827be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4828be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4829be168c0dSopenharmony_ci+    auto value = prim->value_as_GroupNormFusion();
4830be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4831be168c0dSopenharmony_ci+      return value->affine();
4832be168c0dSopenharmony_ci+    } else {
4833be168c0dSopenharmony_ci+      return false;
4834be168c0dSopenharmony_ci+    }
4835be168c0dSopenharmony_ci+  } else {
4836be168c0dSopenharmony_ci+    return false;
4837be168c0dSopenharmony_ci+  }
4838be168c0dSopenharmony_ci+}
4839be168c0dSopenharmony_ci+
4840be168c0dSopenharmony_ci+void MindIR_GroupNormFusion_SetAffine(PrimitivePtr *primitive, bool affine) {
4841be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4842be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4843be168c0dSopenharmony_ci+    auto value = prim->value_as_GroupNormFusion();
4844be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4845be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4846be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateGroupNormFusion(fbb, value->num_groups(), value->epsilon(), affine);
4847be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_GROUP_NORM_FUSION), ops_offset.o);
4848be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4849be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4850be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4851be168c0dSopenharmony_ci+      free(*primitive);
4852be168c0dSopenharmony_ci+      *primitive = ret_value;
4853be168c0dSopenharmony_ci+    }
4854be168c0dSopenharmony_ci+  }
4855be168c0dSopenharmony_ci+}
4856be168c0dSopenharmony_ci+
4857be168c0dSopenharmony_ci+// ********** Log1p **********
4858be168c0dSopenharmony_ci+PrimitivePtr MindIR_Log1p_CreatePrimitive() {
4859be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
4860be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateLog1p(fbb);
4861be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_LOG1P), ops_offset.o);
4862be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
4863be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4864be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4865be168c0dSopenharmony_ci+  return ret_value;
4866be168c0dSopenharmony_ci+}
4867be168c0dSopenharmony_ci+
4868be168c0dSopenharmony_ci+// ********** SparseFillEmptyRows **********
4869be168c0dSopenharmony_ci+PrimitivePtr MindIR_SparseFillEmptyRows_CreatePrimitive() {
4870be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
4871be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateSparseFillEmptyRows(fbb);
4872be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SPARSE_FILL_EMPTY_ROWS), ops_offset.o);
4873be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
4874be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4875be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4876be168c0dSopenharmony_ci+  return ret_value;
4877be168c0dSopenharmony_ci+}
4878be168c0dSopenharmony_ci+
4879be168c0dSopenharmony_ci+// ********** SparseReshape **********
4880be168c0dSopenharmony_ci+PrimitivePtr MindIR_SparseReshape_CreatePrimitive() {
4881be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
4882be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateSparseReshape(fbb);
4883be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SPARSE_RESHAPE), ops_offset.o);
4884be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
4885be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4886be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4887be168c0dSopenharmony_ci+  return ret_value;
4888be168c0dSopenharmony_ci+}
4889be168c0dSopenharmony_ci+
4890be168c0dSopenharmony_ci+// ********** SparseSegmentSum **********
4891be168c0dSopenharmony_ci+PrimitivePtr MindIR_SparseSegmentSum_CreatePrimitive() {
4892be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
4893be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateSparseSegmentSum(fbb);
4894be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SPARSE_SEGMENT_SUM), ops_offset.o);
4895be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
4896be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4897be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4898be168c0dSopenharmony_ci+  return ret_value;
4899be168c0dSopenharmony_ci+}
4900be168c0dSopenharmony_ci+
4901be168c0dSopenharmony_ci+// ********** ScatterElements **********
4902be168c0dSopenharmony_ci+PrimitivePtr MindIR_ScatterElements_CreatePrimitive(int64_t axis) {
4903be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
4904be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateScatterElements(fbb, axis);
4905be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SCATTER_ELEMENTS), ops_offset.o);
4906be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
4907be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4908be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4909be168c0dSopenharmony_ci+  return ret_value;
4910be168c0dSopenharmony_ci+}
4911be168c0dSopenharmony_ci+
4912be168c0dSopenharmony_ci+int64_t MindIR_ScatterElements_GetAxis(ConstPrimitivePtr primitive) {
4913be168c0dSopenharmony_ci+  if (primitive != nullptr) {
4914be168c0dSopenharmony_ci+    auto prim = static_cast<const schema::Primitive *>(primitive);
4915be168c0dSopenharmony_ci+    auto value = prim->value_as_ScatterElements();
4916be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4917be168c0dSopenharmony_ci+      return value->axis();
4918be168c0dSopenharmony_ci+    } else {
4919be168c0dSopenharmony_ci+      return 0;
4920be168c0dSopenharmony_ci+    }
4921be168c0dSopenharmony_ci+  } else {
4922be168c0dSopenharmony_ci+    return 0;
4923be168c0dSopenharmony_ci+  }
4924be168c0dSopenharmony_ci+}
4925be168c0dSopenharmony_ci+
4926be168c0dSopenharmony_ci+void MindIR_ScatterElements_SetAxis(PrimitivePtr *primitive, int64_t axis) {
4927be168c0dSopenharmony_ci+  if (primitive != nullptr && *primitive != nullptr) {
4928be168c0dSopenharmony_ci+    auto prim = static_cast<schema::Primitive *>(*primitive);
4929be168c0dSopenharmony_ci+    auto value = prim->value_as_ScatterElements();
4930be168c0dSopenharmony_ci+    if (prim != nullptr && value != nullptr) {
4931be168c0dSopenharmony_ci+      flatbuffers::FlatBufferBuilder fbb;
4932be168c0dSopenharmony_ci+      auto ops_offset = schema::CreateScatterElements(fbb, axis);
4933be168c0dSopenharmony_ci+      auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_SCATTER_ELEMENTS), ops_offset.o);
4934be168c0dSopenharmony_ci+      fbb.Finish(prim_offset);
4935be168c0dSopenharmony_ci+      auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4936be168c0dSopenharmony_ci+      auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4937be168c0dSopenharmony_ci+      free(*primitive);
4938be168c0dSopenharmony_ci+      *primitive = ret_value;
4939be168c0dSopenharmony_ci+    }
4940be168c0dSopenharmony_ci+  }
4941be168c0dSopenharmony_ci+}
4942be168c0dSopenharmony_ci+
4943be168c0dSopenharmony_ci+// ********** Triu **********
4944be168c0dSopenharmony_ci+PrimitivePtr MindIR_Triu_CreatePrimitive() {
4945be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
4946be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateTriu(fbb);
4947be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_TRIU), ops_offset.o);
4948be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
4949be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4950be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4951be168c0dSopenharmony_ci+  return ret_value;
4952be168c0dSopenharmony_ci+}
4953be168c0dSopenharmony_ci+
4954be168c0dSopenharmony_ci+// ********** Tril **********
4955be168c0dSopenharmony_ci+PrimitivePtr MindIR_Tril_CreatePrimitive() {
4956be168c0dSopenharmony_ci+  flatbuffers::FlatBufferBuilder fbb;
4957be168c0dSopenharmony_ci+  auto ops_offset = schema::CreateTril(fbb);
4958be168c0dSopenharmony_ci+  auto prim_offset = schema::CreatePrimitive(fbb, static_cast<schema::PrimitiveType>(NODE_TYPE_TRIL), ops_offset.o);
4959be168c0dSopenharmony_ci+  fbb.Finish(prim_offset);
4960be168c0dSopenharmony_ci+  auto new_addr = MindIRMemoryManager::GetInstance()->CreatePrimitiveFromBuilder(fbb, nullptr);
4961be168c0dSopenharmony_ci+  auto ret_value = flatbuffers::GetMutableRoot<schema::Primitive>(new_addr);
4962be168c0dSopenharmony_ci+  return ret_value;
4963be168c0dSopenharmony_ci+}
4964be168c0dSopenharmony_ci+}  // namespace lite
4965be168c0dSopenharmony_ci+}  // namespace mindspore
4966be168c0dSopenharmony_cidiff --git a/mindspore/lite/mindir/src/mindir_tensor.cc b/mindspore/lite/mindir/src/mindir_tensor.cc
4967be168c0dSopenharmony_ciindex 8888e2c9..0e6a631e 100644
4968be168c0dSopenharmony_ci--- a/mindspore/lite/mindir/src/mindir_tensor.cc
4969be168c0dSopenharmony_ci+++ b/mindspore/lite/mindir/src/mindir_tensor.cc
4970be168c0dSopenharmony_ci@@ -341,6 +341,19 @@ void MindIR_Tensor_SetQuantParams(TensorPtr *tensor, const std::vector<QuantPara
4971be168c0dSopenharmony_ci   }
4972be168c0dSopenharmony_ci }
4973be168c0dSopenharmony_ci 
4974be168c0dSopenharmony_ci+int32_t MindIR_Tensor_GetNodeType(ConstTensorPtr tensor) {
4975be168c0dSopenharmony_ci+  if (tensor != nullptr) {
4976be168c0dSopenharmony_ci+    auto value = static_cast<const schema::Tensor *>(tensor);
4977be168c0dSopenharmony_ci+    if (value != nullptr) {
4978be168c0dSopenharmony_ci+      return value->nodeType();
4979be168c0dSopenharmony_ci+    } else {
4980be168c0dSopenharmony_ci+      return 0;
4981be168c0dSopenharmony_ci+    }
4982be168c0dSopenharmony_ci+  } else {
4983be168c0dSopenharmony_ci+    return 0;
4984be168c0dSopenharmony_ci+  }
4985be168c0dSopenharmony_ci+}
4986be168c0dSopenharmony_ci+
4987be168c0dSopenharmony_ci void MindIR_Tensor_Destroy(TensorPtr *tensor) {
4988be168c0dSopenharmony_ci   if (tensor != nullptr && *tensor != nullptr) {
4989be168c0dSopenharmony_ci     auto schema = static_cast<schema::Tensor *>(*tensor);
4990be168c0dSopenharmony_ci-- 
4991be168c0dSopenharmony_ci2.17.1
4992be168c0dSopenharmony_ci
4993