eager_generator.h 17.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
// Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once

#include <map>
#include <set>
#include <string>

// NOTE(zhiqiu): Commonly, the inputs in auto-generated OP function are
// determined by the OP`s proto automatically, i.e., all the inputs registered
// in OpMaker.
// However, some OPs have dispensable inputs, which means the input can
// be none for some conditions. It is discovered that most dispensable inputs
// is not used in imperative mode, so we drop those inputs when generating OP
// functions. While, for very few OPs, the dispensable inputs are used, we
// need to manually specify them in this map.
std::map<std::string, std::set<std::string>> op_ins_map = {
    {"layer_norm", {"X", "Scale", "Bias"}},
    {"bincount", {"X", "Weights"}},
    {"fused_attention",
33 34 35 36 37 38 39 40 41 42 43
     {"X",
      "LnScale",
      "LnBias",
      "QKVW",
      "QKVBias",
      "CacheKV",
      "SrcMask",
      "OutLinearW",
      "OutLinearBias",
      "Ln2Scale",
      "Ln2Bias"}},
44
    {"fused_gate_attention",
45 46 47 48 49 50 51 52 53 54 55
     {"Query",
      "Key",
      "QueryWeight",
      "KeyWeight",
      "ValueWeight",
      "QKVWeight",
      "NonbatchedBias",
      "SrcMask",
      "GateWeight",
      "GateBias",
      "OutLinearWeight",
56
      "OutLinearBias"}},
57
    {"fused_multi_transformer",
58 59 60 61 62 63
     {"X",
      "LnScale",
      "LnBias",
      "QKVW",
      "QKVBias",
      "CacheKV",
64
      "PreCaches",
65
      "RotaryPosEmb",
66
      "TimeStep",
67
      "SeqLengths",
68 69 70 71 72 73 74 75 76
      "SrcMask",
      "OutLinearW",
      "OutLinearBias",
      "FFNLnScale",
      "FFNLnBias",
      "FFN1Weight",
      "FFN1Bias",
      "FFN2Weight",
      "FFN2Bias"}},
77 78 79 80 81 82
    {"fused_multi_transformer_int8",
     {"X",           "LnScale",           "LnBias",       "QKVW",
      "QKVBias",     "CacheKV",           "TimeStep",     "SrcMask",
      "OutLinearW",  "OutLinearBias",     "FFNLnScale",   "FFNLnBias",
      "FFN1Weight",  "FFN1Bias",          "FFN2Weight",   "FFN2Bias",
      "QKVOutScale", "OutLinearOutScale", "FFN1OutScale", "FFN2OutScale"}},
83 84
    {"fused_bias_dropout_residual_layer_norm",
     {"X", "Residual", "Bias", "LnScale", "LnBias"}},
85 86 87 88
    {"instance_norm", {"X", "Scale", "Bias"}},
    {"gru_unit", {"Input", "HiddenPrev", "Weight", "Bias"}},
    {"label_smooth", {"X", "PriorDist"}},
    {"assign", {"X"}},
89 90
    {"crop", {"X", "Y", "Offsets"}},
    {"crop_tensor", {"X", "Shape", "Offsets"}},
91 92
    {"reshape2", {"X", "Shape"}},
    {"expand", {"X", "ExpandTimes"}},
W
wanghuancoder 已提交
93
    {"slice",
94 95 96 97
     {"Input",
      "StartsTensor",
      "EndsTensor",
      "StartsTensorList",
W
wanghuancoder 已提交
98 99
      "EndsTensorList"}},
    {"strided_slice",
100 101 102 103 104 105 106
     {"Input",
      "StartsTensor",
      "EndsTensor",
      "StridesTensor",
      "StartsTensorList",
      "EndsTensorList",
      "StridesTensorList"}},
W
wanghuancoder 已提交
107
    {"set_value",
108 109 110 111
     {"Input",
      "ValueTensor",
      "StartsTensorList",
      "EndsTensorList",
W
wanghuancoder 已提交
112
      "StepsTensorList"}},
113 114 115
    {"fake_quantize_dequantize_moving_average_abs_max",
     {"X", "InScale", "InAccum", "InState"}},
    {"nll_loss", {"X", "Label", "Weight"}},
116
    {"smooth_l1_loss", {"X", "Y", "InsideWeight", "OutsideWeight"}},
117 118
    {"bilinear_tensor_product", {"X", "Y", "Weight", "Bias"}},
    {"gather", {"X", "Index", "Axis"}},
K
kuizhiqing 已提交
119
    {"repeat_interleave", {"X", "RepeatsTensor"}},
120 121
    {"roi_pool", {"X", "ROIs", "RoisNum"}},
    {"roi_align", {"X", "ROIs", "RoisNum"}},
122
    {"prroi_pool", {"X", "ROIs", "BatchRoINums"}},
123 124 125 126 127 128 129 130 131 132 133
    {"psroi_pool", {"X", "ROIs", "RoisNum"}},
    {"collect_fpn_proposals",
     {"MultiLevelRois", "MultiLevelScores", "MultiLevelRoIsNum"}},
    {"distribute_fpn_proposals", {"FpnRois", "RoisNum"}},
    {"warpctc", {"Logits", "Label", "LogitsLength", "LabelLength"}},
    {"hierarchical_sigmoid",
     {"X", "W", "Label", "PathTable", "PathCode", "Bias"}},
    {"moving_average_abs_max_scale", {"X", "InAccum", "InState"}},
    {"multiclass_nms3", {"BBoxes", "Scores", "RoisNum"}},
    {"box_coder", {"PriorBox", "PriorBoxVar", "TargetBox"}},
    {"momentum", {"Param", "Grad", "Velocity", "LearningRate", "MasterParam"}},
134 135
    {"merged_momentum",
     {"Param", "Grad", "Velocity", "LearningRate", "MasterParam"}},
136 137
    {"sparse_momentum",
     {"Param", "Grad", "Velocity", "Index", "LearningRate", "MasterParam"}},
138 139 140
    {"rnn", {"Input", "PreState", "WeightList", "SequenceLength"}},
    {"run_program", {"X", "Params"}},
    {"fused_feedforward",
141 142 143 144 145 146 147 148
     {"Dropout1Seed",
      "Dropout2Seed",
      "Linear1Bias",
      "Linear2Bias",
      "Ln1Scale",
      "Ln1Bias",
      "Ln2Scale",
      "Ln2Bias"}},
149 150
    {"faster_tokenizer", {"Text", "Vocab", "TextPair"}},
    {"matrix_rank", {"X", "TolTensor"}},
151 152 153 154 155 156 157 158
    {"rmsprop",
     {"Param",
      "MeanSquare",
      "Grad",
      "Moment",
      "LearningRate",
      "MeanGrad",
      "MasterParam"}},
159
    {"adam",
160 161 162 163 164 165 166 167
     {"Param",
      "Grad",
      "LearningRate",
      "Moment1",
      "Moment2",
      "Beta1Pow",
      "Beta2Pow",
      "MasterParam"}},
Z
zhangbo9674 已提交
168
    {"merged_adam",
169 170 171 172 173 174 175 176
     {"Param",
      "Grad",
      "LearningRate",
      "Moment1",
      "Moment2",
      "Beta1Pow",
      "Beta2Pow",
      "MasterParam"}},
177
    {"fused_adam",
178 179 180 181 182 183 184 185 186
     {"Params",
      "Grads",
      "LearningRate",
      "Moments1",
      "Moments2",
      "Beta1Pows",
      "Beta2Pows",
      "MasterParams",
      "SkipUpdate"}},
187
    {"adamw",
188 189 190 191 192 193 194 195
     {"Param",
      "Grad",
      "LearningRate",
      "Moment1",
      "Moment2",
      "Beta1Pow",
      "Beta2Pow",
      "MasterParam"}},
196 197 198 199 200 201 202 203
    {"adamax",
     {"Param",
      "Grad",
      "LearningRate",
      "Moment",
      "InfNorm",
      "Beta1Pow",
      "MasterParam"}},
204
    {"lamb",
205 206 207 208 209 210 211 212
     {"Param",
      "Grad",
      "LearningRate",
      "Moment1",
      "Moment2",
      "Beta1Pow",
      "Beta2Pow",
      "MasterParam"}},
213 214
    {"sparse_attention",
     {"Q", "K", "V", "Offset", "Columns", "KeyPaddingMask", "AttnMask"}},
215
    {"sgd", {"Param", "LearningRate", "Grad", "MasterParam"}},
216
    {"adagrad", {"Param", "Grad", "Moment", "LearningRate", "MasterParam"}},
217 218
    {"adadelta",
     {"Param", "Grad", "AvgSquaredGrad", "AvgSquaredUpdate", "MasterParam"}},
S
Siming Dai 已提交
219
    {"graph_khop_sampler", {"Row", "Eids", "Col_Ptr", "X"}},
W
Weilong Wu 已提交
220
    {"nce",
221 222 223 224 225 226 227 228
     {"Input",
      "Label",
      "Weight",
      "Bias",
      "SampleWeight",
      "CustomDistProbs",
      "CustomDistAlias",
      "CustomDistAliasProbs"}},
229
    {"yolov3_loss", {"X", "GTBox", "GTLabel", "GTScore"}},
F
furnace 已提交
230
    {"check_finite_and_unscale", {"X", "Scale", "FloatStatus"}},
231
    {"group_norm", {"X", "Scale", "Bias"}},
232 233 234
    {"linear_chain_crf", {"Emission", "Transition", "Label", "Length"}},
    {"crf_decoding", {"Emission", "Transition", "Label", "Length"}},
    {"chunk_eval", {"Inference", "Label", "SeqLength"}},
235
    {"sequence_mask", {"X", "MaxLenTensor"}},
S
Siming Dai 已提交
236 237 238
    {"graph_reindex",
     {"X", "Neighbors", "Count", "HashTable_Value", "HashTable_Index"}},
    {"graph_sample_neighbors", {"Row", "Col_Ptr", "X", "Eids", "Perm_Buffer"}},
239 240 241 242 243
    {"crop", {"X", "Y", "Offsets"}},
    {"batch_norm",
     {"X", "Scale", "Bias", "Mean", "Variance", "MomentumTensor"}},
    {"inplace_abn",
     {"X", "Scale", "Bias", "Mean", "Variance", "MomentumTensor"}},
244 245 246 247 248
    {"linear_interp", {"X", "OutSize"}},
    {"bilinear_interp", {"X", "OutSize"}},
    {"trilinear_interp", {"X", "OutSize"}},
    {"nearest_interp", {"X", "OutSize"}},
    {"bicubic_interp", {"X", "OutSize"}},
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
    {"resnet_basic_block",
     {"X",
      "Filter1",
      "Scale1",
      "Bias1",
      "Mean1",
      "Var1",
      "Filter2",
      "Scale2",
      "Bias2",
      "Mean2",
      "Var2",
      "Filter3",
      "Scale3",
      "Bias3",
      "Mean3",
      "Var3"}},
266
    {"graph_send_recv", {"X", "Src_index", "Dst_index", "Out_size"}},
267
    {"graph_send_ue_recv", {"X", "Y", "Src_index", "Dst_index", "Out_size"}},
268 269 270 271 272 273 274 275 276 277 278 279 280 281
};

// NOTE(zhiqiu): Like op_ins_map.
// Commonly, the outputs in auto-generated OP function are determined by the
// OP`s proto automatically, i.e., all the outputs registered in OpMaker.
// However, some OPs have dispensable outputs, which means the output can
// be none for some conditions. It is discovered that most dispensable outputs
// is not used in imperative mode, so we drop those outputs when generating OP
// functions. While, for very few OPs, the dispensable outputs are used, we
// need to manually specify them in this map.
std::map<std::string, std::set<std::string>> op_outs_map = {
    {"fake_quantize_dequantize_moving_average_abs_max",
     {"Out", "OutScale", "OutAccum", "OutState"}},
    {"batch_norm",
282 283 284 285 286
     {"Y",
      "MeanOut",
      "VarianceOut",
      "SavedMean",
      "SavedVariance",
287
      "ReserveSpace"}},
288
    {"lstsq", {"Solution", "Residuals", "Rank", "SingularValues"}},
289
    {"inplace_abn",
290 291 292 293 294
     {"Y",
      "MeanOut",
      "VarianceOut",
      "SavedMean",
      "SavedVariance",
295
      "ReserveSpace"}},
296 297 298 299 300 301 302 303 304 305
    {"fused_attention", {"LnMean",         "LnVariance",
                         "LnOut",          "QKVOut",
                         "QKVBiasOut",     "TransposeOut2",
                         "QKOut",          "QKTVOut",
                         "SoftmaxOut",     "AttnDropoutMaskOut",
                         "AttnDropoutOut", "SrcMaskOut",
                         "FMHAOut",        "OutLinearOut",
                         "DropoutMaskOut", "Ln2Mean",
                         "Ln2Variance",    "BiasDropoutResidualOut",
                         "CacheKVOut",     "Y"}},
306 307
    {"fused_bias_dropout_residual_layer_norm",
     {"BiasDropoutResidualOut", "DropoutMaskOut", "LnMean", "LnVariance", "Y"}},
308
    {"fused_gate_attention",
309 310 311 312 313 314 315 316
     {"QueryTransposeOut",
      "KeyTransposeOut",
      "ValueTransposeOut",
      "QKVTransposeOut",
      "SoftmaxOut",
      "FMHAOut",
      "GateOut",
      "Out"}},
317
    {"sync_batch_norm",
318 319 320 321 322
     {"Y",
      "MeanOut",
      "VarianceOut",
      "SavedMean",
      "SavedVariance",
323
      "ReserveSpace"}},
324 325 326 327 328
    {"adadelta",
     {"ParamOut",
      "AvgSquaredGradOut",
      "AvgSquaredUpdateOut",
      "MasterParamOut"}},
329 330 331 332 333 334 335 336 337
    {"unique", {"Out", "Index", "Indices", "Counts"}},
    {"unique_consecutive", {"Out", "Index", "Counts"}},
    {"generate_proposals", {"RpnRois", "RpnRoiProbs", "RpnRoisNum"}},
    {"collect_fpn_proposals", {"FpnRois", "RoisNum"}},
    {"matrix_nms", {"Out", "Index", "RoisNum"}},
    {"distribute_fpn_proposals",
     {"MultiFpnRois", "RestoreIndex", "MultiLevelRoIsNum"}},
    {"moving_average_abs_max_scale",
     {"Out", "OutScale", "OutAccum", "OutState"}},
338 339 340 341 342 343
    {"rmsprop",
     {"ParamOut",
      "MomentOut",
      "MeanSquareOut",
      "MeanGradOut",
      "MasterParamOut"}},
344 345 346
    {"multiclass_nms3", {"Out", "NmsRoisNum"}},
    {"generate_proposals_v2", {"RpnRois", "RpnRoiProbs", "RpnRoisNum"}},
    {"momentum", {"ParamOut", "VelocityOut", "MasterParamOut"}},
347
    {"merged_momentum", {"ParamOut", "VelocityOut", "MasterParamOut"}},
348
    {"sparse_momentum", {"ParamOut", "VelocityOut", "MasterParamOut"}},
349
    {"rnn", {"DropoutState", "Reserve", "Out", "State"}},
350
    {"run_program", {"DOut", "CUDAGraph"}},
351
    {"adam",
352 353 354 355 356
     {"ParamOut",
      "Moment1Out",
      "Moment2Out",
      "Beta1PowOut",
      "Beta2PowOut",
357
      "MasterParamOut"}},
Z
zhangbo9674 已提交
358
    {"merged_adam",
359 360 361 362 363
     {"ParamOut",
      "Moment1Out",
      "Moment2Out",
      "Beta1PowOut",
      "Beta2PowOut",
Z
zhangbo9674 已提交
364
      "MasterParamOut"}},
365
    {"fused_adam",
366 367 368 369 370 371
     {"ParamsOut",
      "Moments1Out",
      "Moments2Out",
      "Beta1PowsOut",
      "Beta2PowsOut",
      "MasterParamsOut"}},
372
    {"adamw",
373 374 375 376 377
     {"ParamOut",
      "Moment1Out",
      "Moment2Out",
      "Beta1PowOut",
      "Beta2PowOut",
378
      "MasterParamOut"}},
379 380
    {"adamax",
     {"ParamOut", "MomentOut", "InfNormOut", "Beta1Pow", "MasterParamOut"}},
381
    {"sgd", {"ParamOut", "MasterParamOut"}},
382
    {"adagrad", {"ParamOut", "MomentOut", "MasterParamOut"}},
383
    {"lamb",
384 385 386 387 388
     {"ParamOut",
      "Moment1Out",
      "Moment2Out",
      "Beta1PowOut",
      "Beta2PowOut",
389
      "MasterParamOut"}},
390
    {"fused_multi_transformer", {"CacheKVOut", "Out"}},
391
    {"fused_multi_transformer_int8", {"CacheKVOut", "Out"}},
392 393 394 395 396 397
    {"resnet_basic_block",
     {"Y",         "Conv1",     "SavedMean1", "SavedInvstd1", "Mean1Out",
      "Var1Out",   "Conv2",     "SavedMean2", "SavedInvstd2", "Mean2Out",
      "Var2Out",   "Conv3",     "SavedMean3", "SavedInvstd3", "Mean3Out",
      "Var3Out",   "MaxInput1", "MaxFilter1", "MaxInput2",    "MaxFilter2",
      "MaxInput3", "MaxFilter3"}},
398
};
399 400 401 402 403 404 405 406 407 408 409 410 411

// NOTE(zhiqiu): Commonly, the outputs in auto-generated OP function are
// generated in C++ automatically.
// However, some OPs need to pass the outputs from Python instead of generating
// them in C++. There are mainly 2 reasons for that,
// (1) Optimizer OPs need to update the input param in-place, like sgd.
//     So they need to pass the output which is same as input param.
// (2) Very few python APIs has out in their arguments, like fill_constant.
//     So they need to pass the python output to C++.
//     Actually, this is not a good design, since it may break the SSA graph,
//     especially in declarative mode.
// For those OPs, we need to manually specify the outs need to pass in this map.
std::map<std::string, std::set<std::string>> op_passing_outs_map = {
412
    {"sgd", {"ParamOut", "MasterParamOut"}},
413 414 415 416 417 418
    {"rmsprop",
     {"ParamOut",
      "MomentOut",
      "MeanSquareOut",
      "MeanGradOut",
      "MasterParamOut"}},
419
    {"ftrl", {"ParamOut", "SquaredAccumOut", "LinearAccumOut"}},
420 421 422 423 424
    {"adadelta",
     {"ParamOut",
      "AvgSquaredGradOut",
      "AvgSquaredUpdateOut",
      "MasterParamOut"}},
425
    {"adagrad", {"ParamOut", "MomentOut", "MasterParamOut"}},
426
    {"adamax", {"ParamOut", "MomentOut", "InfNormOut", "MasterParamOut"}},
427 428 429 430
    {"dpsgd", {"ParamOut"}},
    {"decayed_adagrad", {"ParamOut", "MomentOut"}},
    {"lars_momentum", {"ParamOut", "VelocityOut"}},
    {"coalesce_tensor", {"Output", "FusedOutput"}},
431
    {"adam",
432 433 434 435 436
     {"ParamOut",
      "Moment1Out",
      "Moment2Out",
      "Beta1PowOut",
      "Beta2PowOut",
437
      "MasterParamOut"}},
Z
zhangbo9674 已提交
438
    {"merged_adam",
439 440 441 442 443
     {"ParamOut",
      "Moment1Out",
      "Moment2Out",
      "Beta1PowOut",
      "Beta2PowOut",
Z
zhangbo9674 已提交
444
      "MasterParamOut"}},
445
    {"fused_adam",
446 447 448 449 450 451
     {"ParamsOut",
      "Moments1Out",
      "Moments2Out",
      "Beta1PowsOut",
      "Beta2PowsOut",
      "MasterParamsOut"}},
452
    {"adamw",
453 454 455 456 457
     {"ParamOut",
      "Moment1Out",
      "Moment2Out",
      "Beta1PowOut",
      "Beta2PowOut",
458
      "MasterParamOut"}},
459
    {"lamb",
460 461 462 463 464
     {"ParamOut",
      "Moment1Out",
      "Moment2Out",
      "Beta1PowOut",
      "Beta2PowOut",
465
      "MasterParamOut"}},
466
    {"average_accumulates",
467 468 469 470 471 472
     {"out_sum_1",
      "out_sum_2",
      "out_sum_3",
      "out_num_accumulates",
      "out_old_num_accumulates",
      "out_num_updates"}},
473
    {"momentum", {"ParamOut", "VelocityOut", "MasterParamOut"}},
474
    {"merged_momentum", {"ParamOut", "VelocityOut", "MasterParamOut"}},
475
    {"sparse_momentum", {"ParamOut", "VelocityOut", "MasterParamOut"}},
476
    {"batch_norm", {"MeanOut", "VarianceOut"}},
477
    {"inplace_abn", {"MeanOut", "VarianceOut"}},
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503
    {"sync_batch_norm", {"MeanOut", "VarianceOut"}},
    {"accuracy", {"Correct", "Total"}},
    {"fill_constant", {"Out"}},
    {"recv_v2", {"Out"}},
    {"partial_recv", {"Out"}},
    {"matmul", {"Out"}},
    {"c_broadcast", {"Out"}},
    {"c_sync_calc_stream", {"Out"}},
    {"c_sync_comm_stream", {"Out"}},
    {"c_reduce_sum", {"Out"}},
    {"c_reduce_max", {"Out"}},
    {"c_reduce_min", {"Out"}},
    {"c_reduce_prod", {"Out"}},
    {"c_reduce", {"Out"}},
    {"c_scatter", {"Out"}},
    {"barrier", {"Out"}},
    {"fake_quantize_dequantize_moving_average_abs_max",
     {"Out", "OutScale", "OutAccum", "OutState"}},
    {"fake_quantize_dequantize_abs_max", {"Out", "OutScale"}},
    {"fake_channel_wise_quantize_dequantize_abs_max", {"Out", "OutScale"}},
    {"check_finite_and_unscale", {"Out", "FoundInfinite"}},
    {"update_loss_scaling",
     {"Out", "LossScaling", "OutGoodSteps", "OutBadSteps"}},
    {"moving_average_abs_max_scale",
     {"Out", "OutScale", "OutAccum", "OutState"}},
    {"rnn", {"DropoutState"}},
504
    {"run_program", {"Out", "DOut", "OutScope", "CUDAGraph"}},
505 506
    {"clear_float_status", {"FloatStatusOut"}},
    {"get_float_status", {"FloatStatusOut"}},
W
wanghuancoder 已提交
507 508
    {"assign", {"Out"}},
    {"assign_value", {"Out"}},
509 510
    {"split", {"Out"}},
    {"concat", {"Out"}},
511
    {"fused_multi_transformer", {"CacheKVOut"}},
512
    {"fused_multi_transformer_int8", {"CacheKVOut"}},
513
    {"group_norm", {"Mean", "Variance"}},
514 515
    {"resnet_basic_block",
     {"Mean1Out", "Var1Out", "Mean2Out", "Var2Out", "Mean3Out", "Var3Out"}},
516 517 518 519 520 521 522 523 524 525 526 527 528 529
};

// NOTE(pangyoki): Tensor View Strategy.
// In this case, a new output varbase will be created, and this varbase will
// reuse the input varbase's allocation.
// It's a map. The key of outer map is the view op name, the value is
// a pair which implies the mapping relationship between the input and
// output varbase.
std::map<std::string, std::pair<std::string, std::string>> view_op_map = {
    {"squeeze2", {"X", "Out"}},  // "X" -> "Out"
    {"unsqueeze2", {"X", "Out"}},
    {"reshape2", {"X", "Out"}},
    {"flatten_contiguous_range", {"X", "Out"}},
};
530 531 532 533 534 535 536 537 538

// NOTE(pangyoki): Special inplace ops that are not supported in temporary.
// The input and output of some inplace ops are special, such as
// duplicate input. These inplace ops have no usage scenarios and
// are not supported in temporary.
std::set<std::string> special_inplace_op_set = {
    "sum",     // `sum` op has duplicate input
    "assign",  // output of `assign` op is in `op_passing_outs_map`
};
539 540 541 542 543 544 545 546

// NOTE(pangyoki): Special no_need_buffer ops that are not supported in
// temporary.
// sequence_conv op will raise error to get no_need_buffer info during
// compiling.
std::set<std::string> special_no_need_buffer_op_set = {
    "sequence_conv",
};