opdef.h.inl 102.1 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 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 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782
// clang-format off
class AdaptivePooling : public OpDefImplBase<AdaptivePooling> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Mode = ::megdnn::param::AdaptivePooling::Mode;
    using Format = ::megdnn::param::AdaptivePooling::Format;
    Mode mode = ::megdnn::param::AdaptivePooling::Mode::MAX;
    Format format = ::megdnn::param::AdaptivePooling::Format::NCHW;
    std::vector<int32_t> shape;
    AdaptivePooling() = default;
    AdaptivePooling(Mode mode_, Format format_, std::vector<int32_t> shape_, std::string scope_ = {}): mode(mode_), format(format_), shape(shape_) { set_scope(scope_); }
    AdaptivePooling(::megdnn::param::AdaptivePooling packed_param_0, std::vector<int32_t> shape_): mode(packed_param_0.mode), format(packed_param_0.format), shape(shape_) {}
    ::megdnn::param::AdaptivePooling param() const {
        return {mode, format};
    }
};

class AddAxis : public OpDefImplBase<AddAxis> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<int32_t> axis;
    AddAxis() = default;
    AddAxis(std::vector<int32_t> axis_, std::string scope_ = {}): axis(axis_) { set_scope(scope_); }
};

class Argmax : public OpDefImplBase<Argmax> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    int32_t axis = 0;
    Argmax() = default;
    Argmax(int32_t axis_, std::string scope_ = {}): axis(axis_) { set_scope(scope_); }
    Argmax(::megdnn::param::Axis packed_param_0): axis(packed_param_0.axis) {}
    ::megdnn::param::Axis param() const {
        return {axis};
    }
};

class Argmin : public OpDefImplBase<Argmin> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    int32_t axis = 0;
    Argmin() = default;
    Argmin(int32_t axis_, std::string scope_ = {}): axis(axis_) { set_scope(scope_); }
    Argmin(::megdnn::param::Axis packed_param_0): axis(packed_param_0.axis) {}
    ::megdnn::param::Axis param() const {
        return {axis};
    }
};

class Argsort : public OpDefImplBase<Argsort> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Order = ::megdnn::param::Argsort::Order;
    Order order = ::megdnn::param::Argsort::Order::ASCENDING;
    Argsort() = default;
    Argsort(Order order_, std::string scope_ = {}): order(order_) { set_scope(scope_); }
    Argsort(::megdnn::param::Argsort packed_param_0): order(packed_param_0.order) {}
    ::megdnn::param::Argsort param() const {
        return {order};
    }
};

class AssertEqual : public OpDefImplBase<AssertEqual> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    float maxerr = 0.0001;
    bool verbose = false;
    AssertEqual() = default;
    AssertEqual(float maxerr_, bool verbose_, std::string scope_ = {}): maxerr(maxerr_), verbose(verbose_) { set_scope(scope_); }
    AssertEqual(::megdnn::param::AssertEqual packed_param_0): maxerr(packed_param_0.maxerr), verbose(packed_param_0.verbose) {}
    ::megdnn::param::AssertEqual param() const {
        return {maxerr, verbose};
    }
};

class AtlasRuntime : public OpDefImplBase<AtlasRuntime> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::string buf;
    size_t buf_size;
    AtlasRuntime() = default;
    AtlasRuntime(std::string buf_, size_t buf_size_, std::string scope_ = {}): buf(buf_), buf_size(buf_size_) { set_scope(scope_); }
};

class Barrier : public OpDefImplBase<Barrier> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    ::mgb::CompNode comp_node;
    uint32_t nr_outputs;
    Barrier() = default;
    Barrier(::mgb::CompNode comp_node_, uint32_t nr_outputs_, std::string scope_ = {}): comp_node(comp_node_), nr_outputs(nr_outputs_) { set_scope(scope_); }
};

class BatchConvBias : public OpDefImplBase<BatchConvBias> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using NonlineMode = ::megdnn::param::BatchConvBias::NonlineMode;
    using Mode = ::megdnn::param::BatchConvBias::Mode;
    using Sparse = ::megdnn::param::BatchConvBias::Sparse;
    using Format = ::megdnn::param::BatchConvBias::Format;
    using ComputeMode = ::megdnn::param::BatchConvBias::ComputeMode;
    using Strategy = ::megdnn::param::ExecutionPolicy::Strategy;
    NonlineMode nonlineMode = ::megdnn::param::BatchConvBias::NonlineMode::IDENTITY;
    Mode mode = ::megdnn::param::BatchConvBias::Mode::CROSS_CORRELATION;
    uint32_t pad_h = 0;
    uint32_t pad_w = 0;
    uint32_t stride_h = 1;
    uint32_t stride_w = 1;
    uint32_t dilate_h = 1;
    uint32_t dilate_w = 1;
    Sparse sparse = ::megdnn::param::BatchConvBias::Sparse::DENSE;
    Format format = ::megdnn::param::BatchConvBias::Format::NCHW;
    ComputeMode compute_mode = ::megdnn::param::BatchConvBias::ComputeMode::DEFAULT;
    Strategy strategy = static_cast<::megdnn::param::ExecutionPolicy::Strategy>(1);
    uint64_t workspace_limit = 18446744073709551615ull;
    ::megdnn::DType dtype;
    BatchConvBias() = default;
    BatchConvBias(NonlineMode nonlineMode_, Mode mode_, uint32_t pad_h_, uint32_t pad_w_, uint32_t stride_h_, uint32_t stride_w_, uint32_t dilate_h_, uint32_t dilate_w_, Sparse sparse_, Format format_, ComputeMode compute_mode_, Strategy strategy_, uint64_t workspace_limit_, ::megdnn::DType dtype_, std::string scope_ = {}): nonlineMode(nonlineMode_), mode(mode_), pad_h(pad_h_), pad_w(pad_w_), stride_h(stride_h_), stride_w(stride_w_), dilate_h(dilate_h_), dilate_w(dilate_w_), sparse(sparse_), format(format_), compute_mode(compute_mode_), strategy(strategy_), workspace_limit(workspace_limit_), dtype(dtype_) {
        set_scope(scope_);
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    BatchConvBias(::megdnn::param::BatchConvBias packed_param_0, ::megdnn::param::ExecutionPolicy packed_param_1, ::megdnn::DType dtype_): nonlineMode(packed_param_0.nonlineMode), mode(packed_param_0.mode), pad_h(packed_param_0.pad_h), pad_w(packed_param_0.pad_w), stride_h(packed_param_0.stride_h), stride_w(packed_param_0.stride_w), dilate_h(packed_param_0.dilate_h), dilate_w(packed_param_0.dilate_w), sparse(packed_param_0.sparse), format(packed_param_0.format), compute_mode(packed_param_0.compute_mode), strategy(packed_param_1.strategy), workspace_limit(packed_param_1.workspace_limit), dtype(dtype_) {
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    ::megdnn::param::BatchConvBias param() const {
        return {nonlineMode, mode, pad_h, pad_w, stride_h, stride_w, dilate_h, dilate_w, sparse, format, compute_mode};
    }
    ::megdnn::param::ExecutionPolicy policy() const {
        return {strategy, workspace_limit};
    }
};

class BatchNorm : public OpDefImplBase<BatchNorm> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using ParamDim = ::megdnn::param::BN::ParamDim;
    using FwdMode = ::megdnn::param::BN::FwdMode;
    ParamDim param_dim = ::megdnn::param::BN::ParamDim::DIM_11HW;
    FwdMode fwd_mode = ::megdnn::param::BN::FwdMode::TRAINING;
    double epsilon = 1e-4f;
    double avg_factor = 1.f;
    float scale = 1.f;
    float bias = 0.f;
    BatchNorm() = default;
    BatchNorm(ParamDim param_dim_, FwdMode fwd_mode_, double epsilon_, double avg_factor_, float scale_, float bias_, std::string scope_ = {}): param_dim(param_dim_), fwd_mode(fwd_mode_), epsilon(epsilon_), avg_factor(avg_factor_), scale(scale_), bias(bias_) { set_scope(scope_); }
    BatchNorm(::megdnn::param::BN packed_param_0): param_dim(packed_param_0.param_dim), fwd_mode(packed_param_0.fwd_mode), epsilon(packed_param_0.epsilon), avg_factor(packed_param_0.avg_factor), scale(packed_param_0.scale), bias(packed_param_0.bias) {}
    ::megdnn::param::BN param() const {
        return {param_dim, fwd_mode, epsilon, avg_factor, scale, bias};
    }
};

class BatchNormBackward : public OpDefImplBase<BatchNormBackward> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using ParamDim = ::megdnn::param::BN::ParamDim;
    using FwdMode = ::megdnn::param::BN::FwdMode;
    ParamDim param_dim = ::megdnn::param::BN::ParamDim::DIM_11HW;
    FwdMode fwd_mode = ::megdnn::param::BN::FwdMode::TRAINING;
    double epsilon = 1e-4f;
    double avg_factor = 1.f;
    float scale = 1.f;
    float bias = 0.f;
    BatchNormBackward() = default;
    BatchNormBackward(ParamDim param_dim_, FwdMode fwd_mode_, double epsilon_, double avg_factor_, float scale_, float bias_, std::string scope_ = {}): param_dim(param_dim_), fwd_mode(fwd_mode_), epsilon(epsilon_), avg_factor(avg_factor_), scale(scale_), bias(bias_) { set_scope(scope_); }
    BatchNormBackward(::megdnn::param::BN packed_param_0): param_dim(packed_param_0.param_dim), fwd_mode(packed_param_0.fwd_mode), epsilon(packed_param_0.epsilon), avg_factor(packed_param_0.avg_factor), scale(packed_param_0.scale), bias(packed_param_0.bias) {}
    ::megdnn::param::BN param() const {
        return {param_dim, fwd_mode, epsilon, avg_factor, scale, bias};
    }
};

class BatchedIncrMeshIndexing : public OpDefImplBase<BatchedIncrMeshIndexing> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items;
    BatchedIncrMeshIndexing() = default;
    BatchedIncrMeshIndexing(std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items_, std::string scope_ = {}): items(items_) { set_scope(scope_); }
};

class BatchedMatrixMul : public OpDefImplBase<BatchedMatrixMul> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using ComputeMode = ::megdnn::param::MatrixMul::ComputeMode;
    using Format = ::megdnn::param::MatrixMul::Format;
    using Strategy = ::megdnn::param::ExecutionPolicy::Strategy;
    bool transposeA = false;
    bool transposeB = false;
    ComputeMode compute_mode = ::megdnn::param::MatrixMul::ComputeMode::DEFAULT;
    Format format = ::megdnn::param::MatrixMul::Format::DEFAULT;
    Strategy strategy = static_cast<::megdnn::param::ExecutionPolicy::Strategy>(1);
    uint64_t workspace_limit = 18446744073709551615ull;
    uint32_t dimA;
    uint32_t dimB;
    BatchedMatrixMul() = default;
    BatchedMatrixMul(bool transposeA_, bool transposeB_, ComputeMode compute_mode_, Format format_, Strategy strategy_, uint64_t workspace_limit_, uint32_t dimA_, uint32_t dimB_, std::string scope_ = {}): transposeA(transposeA_), transposeB(transposeB_), compute_mode(compute_mode_), format(format_), strategy(strategy_), workspace_limit(workspace_limit_), dimA(dimA_), dimB(dimB_) {
        set_scope(scope_);
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    BatchedMatrixMul(::megdnn::param::MatrixMul packed_param_0, ::megdnn::param::ExecutionPolicy packed_param_1, uint32_t dimA_, uint32_t dimB_): transposeA(packed_param_0.transposeA), transposeB(packed_param_0.transposeB), compute_mode(packed_param_0.compute_mode), format(packed_param_0.format), strategy(packed_param_1.strategy), workspace_limit(packed_param_1.workspace_limit), dimA(dimA_), dimB(dimB_) {
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    ::megdnn::param::MatrixMul param() const {
        return {transposeA, transposeB, compute_mode, format};
    }
    ::megdnn::param::ExecutionPolicy policy() const {
        return {strategy, workspace_limit};
    }
};

class BatchedMeshIndexing : public OpDefImplBase<BatchedMeshIndexing> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items;
    BatchedMeshIndexing() = default;
    BatchedMeshIndexing(std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items_, std::string scope_ = {}): items(items_) { set_scope(scope_); }
};

class BatchedSetMeshIndexing : public OpDefImplBase<BatchedSetMeshIndexing> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items;
    BatchedSetMeshIndexing() = default;
    BatchedSetMeshIndexing(std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items_, std::string scope_ = {}): items(items_) { set_scope(scope_); }
};

class BetaRNG : public OpDefImplBase<BetaRNG> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    uint64_t seed = 0;
    size_t handle;
    BetaRNG() = default;
    BetaRNG(uint64_t seed_, size_t handle_, std::string scope_ = {}): seed(seed_), handle(handle_) { set_scope(scope_); }
    BetaRNG(::megdnn::param::BetaRNG packed_param_0, size_t handle_): seed(packed_param_0.seed), handle(handle_) {}
    ::megdnn::param::BetaRNG param() const {
        return {seed};
    }
};

class Borrow : public OpDefImplBase<Borrow> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    ::mgb::CompNode comp_node;
    Borrow() = default;
    Borrow(::mgb::CompNode comp_node_, std::string scope_ = {}): comp_node(comp_node_) { set_scope(scope_); }
};

class Broadcast : public OpDefImplBase<Broadcast> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<int32_t> shape;
    Broadcast() = default;
    Broadcast(std::vector<int32_t> shape_, std::string scope_ = {}): shape(shape_) { set_scope(scope_); }
    Broadcast(::megdnn::param::Empty, std::vector<int32_t> shape_): shape(shape_) {}
    ::megdnn::param::Empty param() const {
        return {};
    }
};

class CambriconRuntime : public OpDefImplBase<CambriconRuntime> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::string buf;
    size_t buf_size;
    std::string symbol;
    bool tensor_dim_mutable;
    CambriconRuntime() = default;
    CambriconRuntime(std::string buf_, size_t buf_size_, std::string symbol_, bool tensor_dim_mutable_, std::string scope_ = {}): buf(buf_), buf_size(buf_size_), symbol(symbol_), tensor_dim_mutable(tensor_dim_mutable_) { set_scope(scope_); }
};

class CheckNonFinite : public OpDefImplBase<CheckNonFinite> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    float scale = 1.0;
    CheckNonFinite() = default;
    CheckNonFinite(float scale_, std::string scope_ = {}): scale(scale_) { set_scope(scope_); }
    CheckNonFinite(::megdnn::param::CheckNonFinite packed_param_0): scale(packed_param_0.scale) {}
    ::megdnn::param::CheckNonFinite param() const {
        return {scale};
    }
};

class CollectiveComm : public OpDefImplBase<CollectiveComm> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Mode = ::megdnn::param::CollectiveComm::Mode;
    Mode mode = ::megdnn::param::CollectiveComm::Mode::REDUCE_SUM;
    std::string key;
    uint32_t nr_devices;
    uint32_t rank;
    bool is_root;
    bool local_grad;
    std::string addr;
    uint32_t port;
    ::megdnn::DType dtype;
    std::string backend;
    std::string comp_node;
    CollectiveComm() = default;
    CollectiveComm(Mode mode_, std::string key_, uint32_t nr_devices_, uint32_t rank_, bool is_root_, bool local_grad_, std::string addr_, uint32_t port_, ::megdnn::DType dtype_, std::string backend_, std::string comp_node_, std::string scope_ = {}): mode(mode_), key(key_), nr_devices(nr_devices_), rank(rank_), is_root(is_root_), local_grad(local_grad_), addr(addr_), port(port_), dtype(dtype_), backend(backend_), comp_node(comp_node_) { set_scope(scope_); }
    CollectiveComm(::megdnn::param::CollectiveComm packed_param_0, std::string key_, uint32_t nr_devices_, uint32_t rank_, bool is_root_, bool local_grad_, std::string addr_, uint32_t port_, ::megdnn::DType dtype_, std::string backend_, std::string comp_node_): mode(packed_param_0.mode), key(key_), nr_devices(nr_devices_), rank(rank_), is_root(is_root_), local_grad(local_grad_), addr(addr_), port(port_), dtype(dtype_), backend(backend_), comp_node(comp_node_) {}
    ::megdnn::param::CollectiveComm param() const {
        return {mode};
    }
};

class Concat : public OpDefImplBase<Concat> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    int32_t axis = 0;
    ::mgb::CompNode comp_node;
    Concat() = default;
    Concat(int32_t axis_, ::mgb::CompNode comp_node_, std::string scope_ = {}): axis(axis_), comp_node(comp_node_) { set_scope(scope_); }
    Concat(::megdnn::param::Axis packed_param_0, ::mgb::CompNode comp_node_): axis(packed_param_0.axis), comp_node(comp_node_) {}
    ::megdnn::param::Axis param() const {
        return {axis};
    }
};

class CondTake : public OpDefImplBase<CondTake> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    CondTake() = default;
};

class ConvBias : public OpDefImplBase<ConvBias> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using NonlineMode = ::megdnn::param::ConvBias::NonlineMode;
    using Mode = ::megdnn::param::ConvBias::Mode;
    using Sparse = ::megdnn::param::ConvBias::Sparse;
    using Format = ::megdnn::param::ConvBias::Format;
    using ComputeMode = ::megdnn::param::ConvBias::ComputeMode;
    using Strategy = ::megdnn::param::ExecutionPolicy::Strategy;
    NonlineMode nonlineMode = ::megdnn::param::ConvBias::NonlineMode::IDENTITY;
    Mode mode = ::megdnn::param::ConvBias::Mode::CROSS_CORRELATION;
    Sparse sparse = ::megdnn::param::ConvBias::Sparse::DENSE;
    Format format = ::megdnn::param::ConvBias::Format::NCHW;
    uint32_t pad_h = 0;
    uint32_t pad_w = 0;
    uint32_t stride_h = 1;
    uint32_t stride_w = 1;
    uint32_t dilate_h = 1;
    uint32_t dilate_w = 1;
    ComputeMode compute_mode = ::megdnn::param::ConvBias::ComputeMode::DEFAULT;
    Strategy strategy = static_cast<::megdnn::param::ExecutionPolicy::Strategy>(1);
    uint64_t workspace_limit = 18446744073709551615ull;
    ::megdnn::DType dtype;
    ConvBias() = default;
    ConvBias(NonlineMode nonlineMode_, Mode mode_, Sparse sparse_, Format format_, uint32_t pad_h_, uint32_t pad_w_, uint32_t stride_h_, uint32_t stride_w_, uint32_t dilate_h_, uint32_t dilate_w_, ComputeMode compute_mode_, Strategy strategy_, uint64_t workspace_limit_, ::megdnn::DType dtype_, std::string scope_ = {}): nonlineMode(nonlineMode_), mode(mode_), sparse(sparse_), format(format_), pad_h(pad_h_), pad_w(pad_w_), stride_h(stride_h_), stride_w(stride_w_), dilate_h(dilate_h_), dilate_w(dilate_w_), compute_mode(compute_mode_), strategy(strategy_), workspace_limit(workspace_limit_), dtype(dtype_) {
        set_scope(scope_);
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    ConvBias(::megdnn::param::ConvBias packed_param_0, ::megdnn::param::ExecutionPolicy packed_param_1, ::megdnn::DType dtype_): nonlineMode(packed_param_0.nonlineMode), mode(packed_param_0.mode), sparse(packed_param_0.sparse), format(packed_param_0.format), pad_h(packed_param_0.pad_h), pad_w(packed_param_0.pad_w), stride_h(packed_param_0.stride_h), stride_w(packed_param_0.stride_w), dilate_h(packed_param_0.dilate_h), dilate_w(packed_param_0.dilate_w), compute_mode(packed_param_0.compute_mode), strategy(packed_param_1.strategy), workspace_limit(packed_param_1.workspace_limit), dtype(dtype_) {
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    ::megdnn::param::ConvBias param() const {
        return {nonlineMode, mode, sparse, format, pad_h, pad_w, stride_h, stride_w, dilate_h, dilate_w, compute_mode};
    }
    ::megdnn::param::ExecutionPolicy policy() const {
        return {strategy, workspace_limit};
    }
};

class Convolution : public OpDefImplBase<Convolution> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Mode = ::megdnn::param::Convolution::Mode;
    using Sparse = ::megdnn::param::Convolution::Sparse;
    using Format = ::megdnn::param::Convolution::Format;
    using ComputeMode = ::megdnn::param::Convolution::ComputeMode;
    using Strategy = ::megdnn::param::ExecutionPolicy::Strategy;
    Mode mode = ::megdnn::param::Convolution::Mode::CROSS_CORRELATION;
    uint32_t pad_h = 0;
    uint32_t pad_w = 0;
    uint32_t stride_h = 1;
    uint32_t stride_w = 1;
    uint32_t dilate_h = 1;
    uint32_t dilate_w = 1;
    Sparse sparse = ::megdnn::param::Convolution::Sparse::DENSE;
    Format format = ::megdnn::param::Convolution::Format::NCHW;
    ComputeMode compute_mode = ::megdnn::param::Convolution::ComputeMode::DEFAULT;
    Strategy strategy = static_cast<::megdnn::param::ExecutionPolicy::Strategy>(1);
    uint64_t workspace_limit = 18446744073709551615ull;
    Convolution() = default;
    Convolution(Mode mode_, uint32_t pad_h_, uint32_t pad_w_, uint32_t stride_h_, uint32_t stride_w_, uint32_t dilate_h_, uint32_t dilate_w_, Sparse sparse_, Format format_, ComputeMode compute_mode_, Strategy strategy_, uint64_t workspace_limit_, std::string scope_ = {}): mode(mode_), pad_h(pad_h_), pad_w(pad_w_), stride_h(stride_h_), stride_w(stride_w_), dilate_h(dilate_h_), dilate_w(dilate_w_), sparse(sparse_), format(format_), compute_mode(compute_mode_), strategy(strategy_), workspace_limit(workspace_limit_) {
        set_scope(scope_);
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    Convolution(::megdnn::param::Convolution packed_param_0, ::megdnn::param::ExecutionPolicy packed_param_1): mode(packed_param_0.mode), pad_h(packed_param_0.pad_h), pad_w(packed_param_0.pad_w), stride_h(packed_param_0.stride_h), stride_w(packed_param_0.stride_w), dilate_h(packed_param_0.dilate_h), dilate_w(packed_param_0.dilate_w), sparse(packed_param_0.sparse), format(packed_param_0.format), compute_mode(packed_param_0.compute_mode), strategy(packed_param_1.strategy), workspace_limit(packed_param_1.workspace_limit) {
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    ::megdnn::param::Convolution param() const {
        return {mode, pad_h, pad_w, stride_h, stride_w, dilate_h, dilate_w, sparse, format, compute_mode};
    }
    ::megdnn::param::ExecutionPolicy policy() const {
        return {strategy, workspace_limit};
    }
};

class Convolution3D : public OpDefImplBase<Convolution3D> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Mode = ::megdnn::param::Convolution3D::Mode;
    using Sparse = ::megdnn::param::Convolution3D::Sparse;
    using DataType = ::megdnn::param::Convolution3D::DataType;
    using Format = ::megdnn::param::Convolution3D::Format;
    using Strategy = ::megdnn::param::ExecutionPolicy::Strategy;
    Mode mode = ::megdnn::param::Convolution3D::Mode::CROSS_CORRELATION;
    uint32_t pad_d = 0;
    uint32_t pad_h = 0;
    uint32_t pad_w = 0;
    uint32_t stride_d = 1;
    uint32_t stride_h = 1;
    uint32_t stride_w = 1;
    uint32_t dilate_d = 1;
    uint32_t dilate_h = 1;
    uint32_t dilate_w = 1;
    Sparse sparse = ::megdnn::param::Convolution3D::Sparse::DENSE;
    DataType data_type = ::megdnn::param::Convolution3D::DataType::FLOAT;
    Format format = ::megdnn::param::Convolution3D::Format::NCDHW;
    Strategy strategy = static_cast<::megdnn::param::ExecutionPolicy::Strategy>(1);
    uint64_t workspace_limit = 18446744073709551615ull;
    Convolution3D() = default;
    Convolution3D(Mode mode_, uint32_t pad_d_, uint32_t pad_h_, uint32_t pad_w_, uint32_t stride_d_, uint32_t stride_h_, uint32_t stride_w_, uint32_t dilate_d_, uint32_t dilate_h_, uint32_t dilate_w_, Sparse sparse_, DataType data_type_, Format format_, Strategy strategy_, uint64_t workspace_limit_, std::string scope_ = {}): mode(mode_), pad_d(pad_d_), pad_h(pad_h_), pad_w(pad_w_), stride_d(stride_d_), stride_h(stride_h_), stride_w(stride_w_), dilate_d(dilate_d_), dilate_h(dilate_h_), dilate_w(dilate_w_), sparse(sparse_), data_type(data_type_), format(format_), strategy(strategy_), workspace_limit(workspace_limit_) {
        set_scope(scope_);
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    Convolution3D(::megdnn::param::Convolution3D packed_param_0, ::megdnn::param::ExecutionPolicy packed_param_1): mode(packed_param_0.mode), pad_d(packed_param_0.pad_d), pad_h(packed_param_0.pad_h), pad_w(packed_param_0.pad_w), stride_d(packed_param_0.stride_d), stride_h(packed_param_0.stride_h), stride_w(packed_param_0.stride_w), dilate_d(packed_param_0.dilate_d), dilate_h(packed_param_0.dilate_h), dilate_w(packed_param_0.dilate_w), sparse(packed_param_0.sparse), data_type(packed_param_0.data_type), format(packed_param_0.format), strategy(packed_param_1.strategy), workspace_limit(packed_param_1.workspace_limit) {
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    ::megdnn::param::Convolution3D param() const {
        return {mode, pad_d, pad_h, pad_w, stride_d, stride_h, stride_w, dilate_d, dilate_h, dilate_w, sparse, data_type, format};
    }
    ::megdnn::param::ExecutionPolicy policy() const {
        return {strategy, workspace_limit};
    }
};

class Convolution3DBackwardData : public OpDefImplBase<Convolution3DBackwardData> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Mode = ::megdnn::param::Convolution3D::Mode;
    using Sparse = ::megdnn::param::Convolution3D::Sparse;
    using DataType = ::megdnn::param::Convolution3D::DataType;
    using Format = ::megdnn::param::Convolution3D::Format;
    using Strategy = ::megdnn::param::ExecutionPolicy::Strategy;
    Mode mode = ::megdnn::param::Convolution3D::Mode::CROSS_CORRELATION;
    uint32_t pad_d = 0;
    uint32_t pad_h = 0;
    uint32_t pad_w = 0;
    uint32_t stride_d = 1;
    uint32_t stride_h = 1;
    uint32_t stride_w = 1;
    uint32_t dilate_d = 1;
    uint32_t dilate_h = 1;
    uint32_t dilate_w = 1;
    Sparse sparse = ::megdnn::param::Convolution3D::Sparse::DENSE;
    DataType data_type = ::megdnn::param::Convolution3D::DataType::FLOAT;
    Format format = ::megdnn::param::Convolution3D::Format::NCDHW;
    Strategy strategy = static_cast<::megdnn::param::ExecutionPolicy::Strategy>(1);
    uint64_t workspace_limit = 18446744073709551615ull;
    Convolution3DBackwardData() = default;
    Convolution3DBackwardData(Mode mode_, uint32_t pad_d_, uint32_t pad_h_, uint32_t pad_w_, uint32_t stride_d_, uint32_t stride_h_, uint32_t stride_w_, uint32_t dilate_d_, uint32_t dilate_h_, uint32_t dilate_w_, Sparse sparse_, DataType data_type_, Format format_, Strategy strategy_, uint64_t workspace_limit_, std::string scope_ = {}): mode(mode_), pad_d(pad_d_), pad_h(pad_h_), pad_w(pad_w_), stride_d(stride_d_), stride_h(stride_h_), stride_w(stride_w_), dilate_d(dilate_d_), dilate_h(dilate_h_), dilate_w(dilate_w_), sparse(sparse_), data_type(data_type_), format(format_), strategy(strategy_), workspace_limit(workspace_limit_) {
        set_scope(scope_);
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    Convolution3DBackwardData(::megdnn::param::Convolution3D packed_param_0, ::megdnn::param::ExecutionPolicy packed_param_1): mode(packed_param_0.mode), pad_d(packed_param_0.pad_d), pad_h(packed_param_0.pad_h), pad_w(packed_param_0.pad_w), stride_d(packed_param_0.stride_d), stride_h(packed_param_0.stride_h), stride_w(packed_param_0.stride_w), dilate_d(packed_param_0.dilate_d), dilate_h(packed_param_0.dilate_h), dilate_w(packed_param_0.dilate_w), sparse(packed_param_0.sparse), data_type(packed_param_0.data_type), format(packed_param_0.format), strategy(packed_param_1.strategy), workspace_limit(packed_param_1.workspace_limit) {
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    ::megdnn::param::Convolution3D param() const {
        return {mode, pad_d, pad_h, pad_w, stride_d, stride_h, stride_w, dilate_d, dilate_h, dilate_w, sparse, data_type, format};
    }
    ::megdnn::param::ExecutionPolicy policy() const {
        return {strategy, workspace_limit};
    }
};

class ConvolutionBackwardData : public OpDefImplBase<ConvolutionBackwardData> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Mode = ::megdnn::param::Convolution::Mode;
    using Sparse = ::megdnn::param::Convolution::Sparse;
    using Format = ::megdnn::param::Convolution::Format;
    using ComputeMode = ::megdnn::param::Convolution::ComputeMode;
    using Strategy = ::megdnn::param::ExecutionPolicy::Strategy;
    Mode mode = ::megdnn::param::Convolution::Mode::CROSS_CORRELATION;
    uint32_t pad_h = 0;
    uint32_t pad_w = 0;
    uint32_t stride_h = 1;
    uint32_t stride_w = 1;
    uint32_t dilate_h = 1;
    uint32_t dilate_w = 1;
    Sparse sparse = ::megdnn::param::Convolution::Sparse::DENSE;
    Format format = ::megdnn::param::Convolution::Format::NCHW;
    ComputeMode compute_mode = ::megdnn::param::Convolution::ComputeMode::DEFAULT;
    Strategy strategy = static_cast<::megdnn::param::ExecutionPolicy::Strategy>(1);
    uint64_t workspace_limit = 18446744073709551615ull;
    ::megdnn::DType dtype;
    ConvolutionBackwardData() = default;
    ConvolutionBackwardData(Mode mode_, uint32_t pad_h_, uint32_t pad_w_, uint32_t stride_h_, uint32_t stride_w_, uint32_t dilate_h_, uint32_t dilate_w_, Sparse sparse_, Format format_, ComputeMode compute_mode_, Strategy strategy_, uint64_t workspace_limit_, ::megdnn::DType dtype_, std::string scope_ = {}): mode(mode_), pad_h(pad_h_), pad_w(pad_w_), stride_h(stride_h_), stride_w(stride_w_), dilate_h(dilate_h_), dilate_w(dilate_w_), sparse(sparse_), format(format_), compute_mode(compute_mode_), strategy(strategy_), workspace_limit(workspace_limit_), dtype(dtype_) {
        set_scope(scope_);
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    ConvolutionBackwardData(::megdnn::param::Convolution packed_param_0, ::megdnn::param::ExecutionPolicy packed_param_1, ::megdnn::DType dtype_): mode(packed_param_0.mode), pad_h(packed_param_0.pad_h), pad_w(packed_param_0.pad_w), stride_h(packed_param_0.stride_h), stride_w(packed_param_0.stride_w), dilate_h(packed_param_0.dilate_h), dilate_w(packed_param_0.dilate_w), sparse(packed_param_0.sparse), format(packed_param_0.format), compute_mode(packed_param_0.compute_mode), strategy(packed_param_1.strategy), workspace_limit(packed_param_1.workspace_limit), dtype(dtype_) {
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    ::megdnn::param::Convolution param() const {
        return {mode, pad_h, pad_w, stride_h, stride_w, dilate_h, dilate_w, sparse, format, compute_mode};
    }
    ::megdnn::param::ExecutionPolicy policy() const {
        return {strategy, workspace_limit};
    }
};

class Copy : public OpDefImplBase<Copy> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    ::mgb::CompNode comp_node;
    Copy() = default;
    Copy(::mgb::CompNode comp_node_, std::string scope_ = {}): comp_node(comp_node_) { set_scope(scope_); }
};

class Correlation : public OpDefImplBase<Correlation> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Format = ::megdnn::param::Correlation::Format;
    Format format = ::megdnn::param::Correlation::Format::NCHW;
    uint32_t kernel_size = 1;
    uint32_t max_displacement = 1;
    uint32_t stride1 = 1;
    uint32_t stride2 = 1;
    uint32_t pad_size = 0;
    bool is_multiply = true;
    Correlation() = default;
    Correlation(Format format_, uint32_t kernel_size_, uint32_t max_displacement_, uint32_t stride1_, uint32_t stride2_, uint32_t pad_size_, bool is_multiply_, std::string scope_ = {}): format(format_), kernel_size(kernel_size_), max_displacement(max_displacement_), stride1(stride1_), stride2(stride2_), pad_size(pad_size_), is_multiply(is_multiply_) { set_scope(scope_); }
    Correlation(::megdnn::param::Correlation packed_param_0): format(packed_param_0.format), kernel_size(packed_param_0.kernel_size), max_displacement(packed_param_0.max_displacement), stride1(packed_param_0.stride1), stride2(packed_param_0.stride2), pad_size(packed_param_0.pad_size), is_multiply(packed_param_0.is_multiply) {}
    ::megdnn::param::Correlation param() const {
        return {format, kernel_size, max_displacement, stride1, stride2, pad_size, is_multiply};
    }
};

class Cumsum : public OpDefImplBase<Cumsum> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    int32_t axis = 2147483647;
    bool exclusive = true;
    bool reverse = false;
    Cumsum() = default;
    Cumsum(int32_t axis_, bool exclusive_, bool reverse_, std::string scope_ = {}): axis(axis_), exclusive(exclusive_), reverse(reverse_) { set_scope(scope_); }
    Cumsum(::megdnn::param::Cumsum packed_param_0): axis(packed_param_0.axis), exclusive(packed_param_0.exclusive), reverse(packed_param_0.reverse) {}
    ::megdnn::param::Cumsum param() const {
        return {axis, exclusive, reverse};
    }
};

class CvtColor : public OpDefImplBase<CvtColor> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Mode = ::megdnn::param::CvtColor::Mode;
    Mode mode = ::megdnn::param::CvtColor::Mode::RGB2GRAY;
    CvtColor() = default;
    CvtColor(Mode mode_, std::string scope_ = {}): mode(mode_) { set_scope(scope_); }
    CvtColor(::megdnn::param::CvtColor packed_param_0): mode(packed_param_0.mode) {}
    ::megdnn::param::CvtColor param() const {
        return {mode};
    }
};

class DeformableConv : public OpDefImplBase<DeformableConv> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Mode = ::megdnn::param::Convolution::Mode;
    using Sparse = ::megdnn::param::Convolution::Sparse;
    using Format = ::megdnn::param::Convolution::Format;
    using ComputeMode = ::megdnn::param::Convolution::ComputeMode;
    using Strategy = ::megdnn::param::ExecutionPolicy::Strategy;
    Mode mode = ::megdnn::param::Convolution::Mode::CROSS_CORRELATION;
    uint32_t pad_h = 0;
    uint32_t pad_w = 0;
    uint32_t stride_h = 1;
    uint32_t stride_w = 1;
    uint32_t dilate_h = 1;
    uint32_t dilate_w = 1;
    Sparse sparse = ::megdnn::param::Convolution::Sparse::DENSE;
    Format format = ::megdnn::param::Convolution::Format::NCHW;
    ComputeMode compute_mode = ::megdnn::param::Convolution::ComputeMode::DEFAULT;
    Strategy strategy = static_cast<::megdnn::param::ExecutionPolicy::Strategy>(1);
    uint64_t workspace_limit = 18446744073709551615ull;
    DeformableConv() = default;
    DeformableConv(Mode mode_, uint32_t pad_h_, uint32_t pad_w_, uint32_t stride_h_, uint32_t stride_w_, uint32_t dilate_h_, uint32_t dilate_w_, Sparse sparse_, Format format_, ComputeMode compute_mode_, Strategy strategy_, uint64_t workspace_limit_, std::string scope_ = {}): mode(mode_), pad_h(pad_h_), pad_w(pad_w_), stride_h(stride_h_), stride_w(stride_w_), dilate_h(dilate_h_), dilate_w(dilate_w_), sparse(sparse_), format(format_), compute_mode(compute_mode_), strategy(strategy_), workspace_limit(workspace_limit_) {
        set_scope(scope_);
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    DeformableConv(::megdnn::param::Convolution packed_param_0, ::megdnn::param::ExecutionPolicy packed_param_1): mode(packed_param_0.mode), pad_h(packed_param_0.pad_h), pad_w(packed_param_0.pad_w), stride_h(packed_param_0.stride_h), stride_w(packed_param_0.stride_w), dilate_h(packed_param_0.dilate_h), dilate_w(packed_param_0.dilate_w), sparse(packed_param_0.sparse), format(packed_param_0.format), compute_mode(packed_param_0.compute_mode), strategy(packed_param_1.strategy), workspace_limit(packed_param_1.workspace_limit) {
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    ::megdnn::param::Convolution param() const {
        return {mode, pad_h, pad_w, stride_h, stride_w, dilate_h, dilate_w, sparse, format, compute_mode};
    }
    ::megdnn::param::ExecutionPolicy policy() const {
        return {strategy, workspace_limit};
    }
};

class DeformablePSROIPooling : public OpDefImplBase<DeformablePSROIPooling> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    bool no_trans = true;
    float spatial_scale = 1;
    float trans_std = 1;
    uint32_t pooled_h = 1;
    uint32_t pooled_w = 1;
    uint32_t part_size = 1;
    uint32_t sample_per_part = 1;
    DeformablePSROIPooling() = default;
    DeformablePSROIPooling(bool no_trans_, float spatial_scale_, float trans_std_, uint32_t pooled_h_, uint32_t pooled_w_, uint32_t part_size_, uint32_t sample_per_part_, std::string scope_ = {}): no_trans(no_trans_), spatial_scale(spatial_scale_), trans_std(trans_std_), pooled_h(pooled_h_), pooled_w(pooled_w_), part_size(part_size_), sample_per_part(sample_per_part_) { set_scope(scope_); }
    DeformablePSROIPooling(::megdnn::param::DeformablePSROIPooling packed_param_0): no_trans(packed_param_0.no_trans), spatial_scale(packed_param_0.spatial_scale), trans_std(packed_param_0.trans_std), pooled_h(packed_param_0.pooled_h), pooled_w(packed_param_0.pooled_w), part_size(packed_param_0.part_size), sample_per_part(packed_param_0.sample_per_part) {}
    ::megdnn::param::DeformablePSROIPooling param() const {
        return {no_trans, spatial_scale, trans_std, pooled_h, pooled_w, part_size, sample_per_part};
    }
};

class Diag : public OpDefImplBase<Diag> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    int32_t k = 0;
    Diag() = default;
    Diag(int32_t k_, std::string scope_ = {}): k(k_) { set_scope(scope_); }
    Diag(::megdnn::param::Diag packed_param_0): k(packed_param_0.k) {}
    ::megdnn::param::Diag param() const {
        return {k};
    }
};

class Dimshuffle : public OpDefImplBase<Dimshuffle> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<int32_t> pattern;
    Dimshuffle() = default;
    Dimshuffle(std::vector<int32_t> pattern_, std::string scope_ = {}): pattern(pattern_) { set_scope(scope_); }
};

class Dot : public OpDefImplBase<Dot> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    Dot() = default;
    Dot(::megdnn::param::Empty) {}
    ::megdnn::param::Empty param() const {
        return {};
    }
};

class Dropout : public OpDefImplBase<Dropout> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    float drop_prob = 0;
    uint64_t seed = 0;
    size_t handle;
    Dropout() = default;
    Dropout(float drop_prob_, uint64_t seed_, size_t handle_, std::string scope_ = {}): drop_prob(drop_prob_), seed(seed_), handle(handle_) { set_scope(scope_); }
    Dropout(::megdnn::param::Dropout packed_param_0, size_t handle_): drop_prob(packed_param_0.drop_prob), seed(packed_param_0.seed), handle(handle_) {}
    ::megdnn::param::Dropout param() const {
        return {drop_prob, seed};
    }
};

class Elemwise : public OpDefImplBase<Elemwise> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Mode = ::megdnn::param::Elemwise::Mode;
    Mode mode = ::megdnn::param::Elemwise::Mode::RELU;
    Elemwise() = default;
    Elemwise(Mode mode_, std::string scope_ = {}): mode(mode_) { set_scope(scope_); }
    Elemwise(::megdnn::param::Elemwise packed_param_0): mode(packed_param_0.mode) {}
    ::megdnn::param::Elemwise param() const {
        return {mode};
    }
};


template <>
struct ToStringTrait<Elemwise::Mode> {
    std::string operator()(Elemwise::Mode e) const {
        switch (e) {
            case Elemwise::Mode::RELU: return "RELU";
case Elemwise::Mode::ABS: return "ABS";
case Elemwise::Mode::ACOS: return "ACOS";
case Elemwise::Mode::ASIN: return "ASIN";
case Elemwise::Mode::CEIL: return "CEIL";
case Elemwise::Mode::COS: return "COS";
case Elemwise::Mode::EXP: return "EXP";
case Elemwise::Mode::EXPM1: return "EXPM1";
case Elemwise::Mode::FLOOR: return "FLOOR";
case Elemwise::Mode::LOG: return "LOG";
case Elemwise::Mode::LOG1P: return "LOG1P";
case Elemwise::Mode::NEGATE: return "NEGATE";
case Elemwise::Mode::SIGMOID: return "SIGMOID";
case Elemwise::Mode::SIN: return "SIN";
case Elemwise::Mode::TANH: return "TANH";
case Elemwise::Mode::ABS_GRAD: return "ABS_GRAD";
case Elemwise::Mode::ADD: return "ADD";
case Elemwise::Mode::FLOOR_DIV: return "FLOOR_DIV";
case Elemwise::Mode::MAX: return "MAX";
case Elemwise::Mode::MIN: return "MIN";
case Elemwise::Mode::MOD: return "MOD";
case Elemwise::Mode::MUL: return "MUL";
case Elemwise::Mode::POW: return "POW";
case Elemwise::Mode::SIGMOID_GRAD: return "SIGMOID_GRAD";
case Elemwise::Mode::SUB: return "SUB";
case Elemwise::Mode::SWITCH_GT0: return "SWITCH_GT0";
case Elemwise::Mode::TANH_GRAD: return "TANH_GRAD";
case Elemwise::Mode::TRUE_DIV: return "TRUE_DIV";
case Elemwise::Mode::LOG_SUM_EXP: return "LOG_SUM_EXP";
case Elemwise::Mode::LT: return "LT";
case Elemwise::Mode::LEQ: return "LEQ";
case Elemwise::Mode::EQ: return "EQ";
case Elemwise::Mode::SHL: return "SHL";
case Elemwise::Mode::SHR: return "SHR";
case Elemwise::Mode::COND_LEQ_MOV: return "COND_LEQ_MOV";
case Elemwise::Mode::FUSE_MUL_ADD3: return "FUSE_MUL_ADD3";
case Elemwise::Mode::FUSE_MUL_ADD4: return "FUSE_MUL_ADD4";
case Elemwise::Mode::FUSE_ADD_RELU: return "FUSE_ADD_RELU";
case Elemwise::Mode::FUSE_ADD_SIGMOID: return "FUSE_ADD_SIGMOID";
case Elemwise::Mode::FUSE_ADD_TANH: return "FUSE_ADD_TANH";
case Elemwise::Mode::FAST_TANH: return "FAST_TANH";
case Elemwise::Mode::FAST_TANH_GRAD: return "FAST_TANH_GRAD";
case Elemwise::Mode::ROUND: return "ROUND";
case Elemwise::Mode::RMULH: return "RMULH";
case Elemwise::Mode::ATAN2: return "ATAN2";
case Elemwise::Mode::ERF: return "ERF";
case Elemwise::Mode::ERFINV: return "ERFINV";
case Elemwise::Mode::ERFC: return "ERFC";
case Elemwise::Mode::ERFCINV: return "ERFCINV";
case Elemwise::Mode::H_SWISH: return "H_SWISH";
case Elemwise::Mode::H_SWISH_GRAD: return "H_SWISH_GRAD";
case Elemwise::Mode::FUSE_ADD_H_SWISH: return "FUSE_ADD_H_SWISH";
case Elemwise::Mode::NOT: return "NOT";
case Elemwise::Mode::AND: return "AND";
case Elemwise::Mode::OR: return "OR";
case Elemwise::Mode::XOR: return "XOR";
case Elemwise::Mode::SILU: return "SILU";
case Elemwise::Mode::SILU_GRAD: return "SILU_GRAD";
case Elemwise::Mode::GELU: return "GELU";
case Elemwise::Mode::GELU_GRAD: return "GELU_GRAD";
case Elemwise::Mode::COND_LT_MOV: return "COND_LT_MOV";
783 784 785
case Elemwise::Mode::NEQ: return "NEQ";
case Elemwise::Mode::ISNAN: return "ISNAN";
case Elemwise::Mode::ISINF: return "ISINF";
M
Megvii Engine Team 已提交
786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807
case Elemwise::Mode::SINH: return "SINH";
case Elemwise::Mode::COSH: return "COSH";
case Elemwise::Mode::ASINH: return "ASINH";
case Elemwise::Mode::ACOSH: return "ACOSH";
case Elemwise::Mode::ATANH: return "ATANH";
case Elemwise::Mode::TAN: return "TAN";
case Elemwise::Mode::ASINH_GRAD: return "ASINH_GRAD";
case Elemwise::Mode::ACOSH_GRAD: return "ACOSH_GRAD";
case Elemwise::Mode::ATANH_GRAD: return "ATANH_GRAD";
case Elemwise::Mode::PRELU: return "PRELU";
case Elemwise::Mode::CLIP: return "CLIP";
case Elemwise::Mode::PRELU_GRAD: return "PRELU_GRAD";
case Elemwise::Mode::SOFTPLUS: return "SOFTPLUS";
case Elemwise::Mode::SOFTPLUS_GRAD: return "SOFTPLUS_GRAD";
case Elemwise::Mode::RELU6: return "RELU6";
case Elemwise::Mode::RELU6_GRAD: return "RELU6_GRAD";
case Elemwise::Mode::HSIGMOID: return "HSIGMOID";
case Elemwise::Mode::HSIGMOID_GRAD: return "HSIGMOID_GRAD";
case Elemwise::Mode::LOGSIGMOID: return "LOGSIGMOID";
case Elemwise::Mode::SQRT: return "SQRT";
case Elemwise::Mode::SQUARE: return "SQUARE";
case Elemwise::Mode::SIGN: return "SIGN";
808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890
            default:
                return "Elemwise::Mode::Unknown";
        }
    }
};
class ElemwiseMultiType : public OpDefImplBase<ElemwiseMultiType> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Mode = ::megdnn::param::ElemwiseMultiType::Mode;
    Mode mode = ::megdnn::param::ElemwiseMultiType::Mode::FUSE_MUL_ADD3_INT16x32x32x32;
    ::megdnn::DType dtype;
    ElemwiseMultiType() = default;
    ElemwiseMultiType(Mode mode_, ::megdnn::DType dtype_, std::string scope_ = {}): mode(mode_), dtype(dtype_) { set_scope(scope_); }
    ElemwiseMultiType(::megdnn::param::ElemwiseMultiType packed_param_0, ::megdnn::DType dtype_): mode(packed_param_0.mode), dtype(dtype_) {}
    ::megdnn::param::ElemwiseMultiType param() const {
        return {mode};
    }
};


template <>
struct ToStringTrait<ElemwiseMultiType::Mode> {
    std::string operator()(ElemwiseMultiType::Mode e) const {
        switch (e) {
            case ElemwiseMultiType::Mode::FUSE_MUL_ADD3_INT16x32x32x32: return "FUSE_MUL_ADD3_INT16x32x32x32";
case ElemwiseMultiType::Mode::FUSE_MUL_ADD3_IXxF32xF32xI8: return "FUSE_MUL_ADD3_IXxF32xF32xI8";
case ElemwiseMultiType::Mode::ROUND_SHR_SATURATE_IXxI8xI8: return "ROUND_SHR_SATURATE_IXxI8xI8";
case ElemwiseMultiType::Mode::FUSE_ADD_RMULH_ROUND_SHR_SATURATE_INT16x16x16x8: return "FUSE_ADD_RMULH_ROUND_SHR_SATURATE_INT16x16x16x8";
case ElemwiseMultiType::Mode::FUSE_ADD_RMULH_ROUND_SHR_SATURATE_INT32x32x32x8: return "FUSE_ADD_RMULH_ROUND_SHR_SATURATE_INT32x32x32x8";
case ElemwiseMultiType::Mode::ROUND_SHR_SATURATE_IXxI8xI16: return "ROUND_SHR_SATURATE_IXxI8xI16";
case ElemwiseMultiType::Mode::QADD: return "QADD";
case ElemwiseMultiType::Mode::QFUSE_ADD_RELU: return "QFUSE_ADD_RELU";
case ElemwiseMultiType::Mode::QMUL: return "QMUL";
case ElemwiseMultiType::Mode::QMIN: return "QMIN";
case ElemwiseMultiType::Mode::QMAX: return "QMAX";
case ElemwiseMultiType::Mode::QSUB: return "QSUB";
case ElemwiseMultiType::Mode::QTRUE_DIV: return "QTRUE_DIV";
case ElemwiseMultiType::Mode::QFUSE_ADD_SIGMOID: return "QFUSE_ADD_SIGMOID";
case ElemwiseMultiType::Mode::QFUSE_ADD_TANH: return "QFUSE_ADD_TANH";
case ElemwiseMultiType::Mode::QRELU: return "QRELU";
case ElemwiseMultiType::Mode::QABS: return "QABS";
case ElemwiseMultiType::Mode::QSIGMOID: return "QSIGMOID";
case ElemwiseMultiType::Mode::QEXP: return "QEXP";
case ElemwiseMultiType::Mode::QTANH: return "QTANH";
case ElemwiseMultiType::Mode::QFUSE_MUL_ADD3: return "QFUSE_MUL_ADD3";
case ElemwiseMultiType::Mode::QFAST_TANH: return "QFAST_TANH";
case ElemwiseMultiType::Mode::QNEGATE: return "QNEGATE";
case ElemwiseMultiType::Mode::QACOS: return "QACOS";
case ElemwiseMultiType::Mode::QASIN: return "QASIN";
case ElemwiseMultiType::Mode::QCEIL: return "QCEIL";
case ElemwiseMultiType::Mode::QCOS: return "QCOS";
case ElemwiseMultiType::Mode::QEXPM1: return "QEXPM1";
case ElemwiseMultiType::Mode::QFLOOR: return "QFLOOR";
case ElemwiseMultiType::Mode::QLOG: return "QLOG";
case ElemwiseMultiType::Mode::QLOG1P: return "QLOG1P";
case ElemwiseMultiType::Mode::QSIN: return "QSIN";
case ElemwiseMultiType::Mode::QROUND: return "QROUND";
case ElemwiseMultiType::Mode::QERF: return "QERF";
case ElemwiseMultiType::Mode::QERFINV: return "QERFINV";
case ElemwiseMultiType::Mode::QERFC: return "QERFC";
case ElemwiseMultiType::Mode::QERFCINV: return "QERFCINV";
case ElemwiseMultiType::Mode::QABS_GRAD: return "QABS_GRAD";
case ElemwiseMultiType::Mode::QFLOOR_DIV: return "QFLOOR_DIV";
case ElemwiseMultiType::Mode::QMOD: return "QMOD";
case ElemwiseMultiType::Mode::QSIGMOID_GRAD: return "QSIGMOID_GRAD";
case ElemwiseMultiType::Mode::QSWITCH_GT0: return "QSWITCH_GT0";
case ElemwiseMultiType::Mode::QTANH_GRAD: return "QTANH_GRAD";
case ElemwiseMultiType::Mode::QLT: return "QLT";
case ElemwiseMultiType::Mode::QLEQ: return "QLEQ";
case ElemwiseMultiType::Mode::QEQ: return "QEQ";
case ElemwiseMultiType::Mode::QPOW: return "QPOW";
case ElemwiseMultiType::Mode::QLOG_SUM_EXP: return "QLOG_SUM_EXP";
case ElemwiseMultiType::Mode::QFAST_TANH_GRAD: return "QFAST_TANH_GRAD";
case ElemwiseMultiType::Mode::QATAN2: return "QATAN2";
case ElemwiseMultiType::Mode::QCOND_LEQ_MOV: return "QCOND_LEQ_MOV";
case ElemwiseMultiType::Mode::QH_SWISH: return "QH_SWISH";
case ElemwiseMultiType::Mode::QFUSE_ADD_H_SWISH: return "QFUSE_ADD_H_SWISH";
case ElemwiseMultiType::Mode::QH_SWISH_GRAD: return "QH_SWISH_GRAD";
case ElemwiseMultiType::Mode::FUSE_MUL_ADD3_INT16xF32xF32xF32: return "FUSE_MUL_ADD3_INT16xF32xF32xF32";
case ElemwiseMultiType::Mode::MUL_INT16xF32xF32: return "MUL_INT16xF32xF32";
case ElemwiseMultiType::Mode::FUSE_MUL_ADD3_UINT8xF32xF32xF32: return "FUSE_MUL_ADD3_UINT8xF32xF32xF32";
case ElemwiseMultiType::Mode::QCOND_LT_MOV: return "QCOND_LT_MOV";
891 892 893 894 895 896
case ElemwiseMultiType::Mode::EQ: return "EQ";
case ElemwiseMultiType::Mode::NEQ: return "NEQ";
case ElemwiseMultiType::Mode::LT: return "LT";
case ElemwiseMultiType::Mode::LEQ: return "LEQ";
case ElemwiseMultiType::Mode::ISNAN: return "ISNAN";
case ElemwiseMultiType::Mode::ISINF: return "ISINF";
897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946
            default:
                return "ElemwiseMultiType::Mode::Unknown";
        }
    }
};
class ExternOpr : public OpDefImplBase<ExternOpr> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<std::vector<size_t>> output_shapes;
    std::string name;
    std::string data;
    size_t data_len;
    std::vector<::megdnn::DType> output_dtypes;
    ExternOpr() = default;
    ExternOpr(std::vector<std::vector<size_t>> output_shapes_, std::string name_, std::string data_, size_t data_len_, std::vector<::megdnn::DType> output_dtypes_, std::string scope_ = {}): output_shapes(output_shapes_), name(name_), data(data_), data_len(data_len_), output_dtypes(output_dtypes_) { set_scope(scope_); }
};

class Eye : public OpDefImplBase<Eye> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    int32_t k = 0;
    ::megdnn::DType dtype = megdnn::DType::from_enum(megdnn::DTypeEnum::Float32);
    ::mgb::CompNode comp_node;
    Eye() = default;
    Eye(int32_t k_, ::megdnn::DType dtype_, ::mgb::CompNode comp_node_, std::string scope_ = {}): k(k_), dtype(dtype_), comp_node(comp_node_) { set_scope(scope_); }
};

class FakeQuant : public OpDefImplBase<FakeQuant> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    int32_t qmin = -2147483648;
    int32_t qmax = 2147483647;
    FakeQuant() = default;
    FakeQuant(int32_t qmin_, int32_t qmax_, std::string scope_ = {}): qmin(qmin_), qmax(qmax_) { set_scope(scope_); }
    FakeQuant(::megdnn::param::FakeQuant packed_param_0): qmin(packed_param_0.qmin), qmax(packed_param_0.qmax) {}
    ::megdnn::param::FakeQuant param() const {
        return {qmin, qmax};
    }
};

class FastpathCopy : public OpDefImplBase<FastpathCopy> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    FastpathCopy() = default;
};

947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975
class Fill : public OpDefImplBase<Fill> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    float value = 0;
    ::megdnn::DType dtype;
    ::mgb::CompNode comp_node;
    Fill() = default;
    Fill(float value_, ::megdnn::DType dtype_, ::mgb::CompNode comp_node_, std::string scope_ = {}): value(value_), dtype(dtype_), comp_node(comp_node_) { set_scope(scope_); }
    Fill(::megdnn::param::Fill packed_param_0, ::megdnn::DType dtype_, ::mgb::CompNode comp_node_): value(packed_param_0.value), dtype(dtype_), comp_node(comp_node_) {}
    ::megdnn::param::Fill param() const {
        return {value};
    }
};

class FillLike : public OpDefImplBase<FillLike> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    float value = 0;
    ::mgb::CompNode comp_node;
    FillLike() = default;
    FillLike(float value_, ::mgb::CompNode comp_node_, std::string scope_ = {}): value(value_), comp_node(comp_node_) { set_scope(scope_); }
    FillLike(::megdnn::param::Fill packed_param_0, ::mgb::CompNode comp_node_): value(packed_param_0.value), comp_node(comp_node_) {}
    ::megdnn::param::Fill param() const {
        return {value};
    }
};

976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002
class GammaRNG : public OpDefImplBase<GammaRNG> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    uint64_t seed = 0;
    size_t handle;
    GammaRNG() = default;
    GammaRNG(uint64_t seed_, size_t handle_, std::string scope_ = {}): seed(seed_), handle(handle_) { set_scope(scope_); }
    GammaRNG(::megdnn::param::GammaRNG packed_param_0, size_t handle_): seed(packed_param_0.seed), handle(handle_) {}
    ::megdnn::param::GammaRNG param() const {
        return {seed};
    }
};

class GaussianRNG : public OpDefImplBase<GaussianRNG> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    uint64_t seed = 0;
    float mean = 0;
    float std = 1;
    ::megdnn::DType dtype = megdnn::DType::from_enum(megdnn::DTypeEnum::Float32);
    size_t handle;
    GaussianRNG() = default;
    GaussianRNG(uint64_t seed_, float mean_, float std_, ::megdnn::DType dtype_, size_t handle_, std::string scope_ = {}): seed(seed_), mean(mean_), std(std_), dtype(dtype_), handle(handle_) { set_scope(scope_); }
};

1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018
class GeneralNorm : public OpDefImplBase<GeneralNorm> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    bool affine = true;
    float eps = 1e-5f;
    uint64_t axis_start = 0;
    uint64_t axis_end = 0;
    GeneralNorm() = default;
    GeneralNorm(bool affine_, float eps_, uint64_t axis_start_, uint64_t axis_end_, std::string scope_ = {}): affine(affine_), eps(eps_), axis_start(axis_start_), axis_end(axis_end_) { set_scope(scope_); }
    GeneralNorm(::megdnn::param::GeneralNorm packed_param_0): affine(packed_param_0.affine), eps(packed_param_0.eps), axis_start(packed_param_0.axis_start), axis_end(packed_param_0.axis_end) {}
    ::megdnn::param::GeneralNorm param() const {
        return {affine, eps, axis_start, axis_end};
    }
};

1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057
class GetVarShape : public OpDefImplBase<GetVarShape> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    int32_t axis = ::megdnn::param::OptionalAxisV1::INVALID_AXIS;
    GetVarShape() = default;
    GetVarShape(int32_t axis_, std::string scope_ = {}): axis(axis_) { set_scope(scope_); }
    GetVarShape(::megdnn::param::OptionalAxisV1 packed_param_0): axis(packed_param_0.axis) {}
    ::megdnn::param::OptionalAxisV1 param() const {
        return {axis};
    }
};

class GroupLocal : public OpDefImplBase<GroupLocal> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Mode = ::megdnn::param::Convolution::Mode;
    using Sparse = ::megdnn::param::Convolution::Sparse;
    using Format = ::megdnn::param::Convolution::Format;
    using ComputeMode = ::megdnn::param::Convolution::ComputeMode;
    Mode mode = ::megdnn::param::Convolution::Mode::CROSS_CORRELATION;
    uint32_t pad_h = 0;
    uint32_t pad_w = 0;
    uint32_t stride_h = 1;
    uint32_t stride_w = 1;
    uint32_t dilate_h = 1;
    uint32_t dilate_w = 1;
    Sparse sparse = ::megdnn::param::Convolution::Sparse::DENSE;
    Format format = ::megdnn::param::Convolution::Format::NCHW;
    ComputeMode compute_mode = ::megdnn::param::Convolution::ComputeMode::DEFAULT;
    GroupLocal() = default;
    GroupLocal(Mode mode_, uint32_t pad_h_, uint32_t pad_w_, uint32_t stride_h_, uint32_t stride_w_, uint32_t dilate_h_, uint32_t dilate_w_, Sparse sparse_, Format format_, ComputeMode compute_mode_, std::string scope_ = {}): mode(mode_), pad_h(pad_h_), pad_w(pad_w_), stride_h(stride_h_), stride_w(stride_w_), dilate_h(dilate_h_), dilate_w(dilate_w_), sparse(sparse_), format(format_), compute_mode(compute_mode_) { set_scope(scope_); }
    GroupLocal(::megdnn::param::Convolution packed_param_0): mode(packed_param_0.mode), pad_h(packed_param_0.pad_h), pad_w(packed_param_0.pad_w), stride_h(packed_param_0.stride_h), stride_w(packed_param_0.stride_w), dilate_h(packed_param_0.dilate_h), dilate_w(packed_param_0.dilate_w), sparse(packed_param_0.sparse), format(packed_param_0.format), compute_mode(packed_param_0.compute_mode) {}
    ::megdnn::param::Convolution param() const {
        return {mode, pad_h, pad_w, stride_h, stride_w, dilate_h, dilate_w, sparse, format, compute_mode};
    }
};

1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074
class GroupNorm : public OpDefImplBase<GroupNorm> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Format = ::megdnn::param::GroupNorm::Format;
    bool affine = true;
    float eps = 1e-5f;
    uint32_t group = 1;
    Format format = ::megdnn::param::GroupNorm::Format::NCHW;
    GroupNorm() = default;
    GroupNorm(bool affine_, float eps_, uint32_t group_, Format format_, std::string scope_ = {}): affine(affine_), eps(eps_), group(group_), format(format_) { set_scope(scope_); }
    GroupNorm(::megdnn::param::GroupNorm packed_param_0): affine(packed_param_0.affine), eps(packed_param_0.eps), group(packed_param_0.group), format(packed_param_0.format) {}
    ::megdnn::param::GroupNorm param() const {
        return {affine, eps, group, format};
    }
};

1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185
class Identity : public OpDefImplBase<Identity> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    Identity() = default;
};

class Images2Neibs : public OpDefImplBase<Images2Neibs> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    uint32_t pad_h = 0;
    uint32_t pad_w = 0;
    uint32_t stride_h = 1;
    uint32_t stride_w = 1;
    uint32_t dilate_h = 1;
    uint32_t dilate_w = 1;
    uint32_t window_h = 3;
    uint32_t window_w = 3;
    Images2Neibs() = default;
    Images2Neibs(uint32_t pad_h_, uint32_t pad_w_, uint32_t stride_h_, uint32_t stride_w_, uint32_t dilate_h_, uint32_t dilate_w_, uint32_t window_h_, uint32_t window_w_, std::string scope_ = {}): pad_h(pad_h_), pad_w(pad_w_), stride_h(stride_h_), stride_w(stride_w_), dilate_h(dilate_h_), dilate_w(dilate_w_), window_h(window_h_), window_w(window_w_) { set_scope(scope_); }
    Images2Neibs(::megdnn::param::Images2Neibs packed_param_0): pad_h(packed_param_0.pad_h), pad_w(packed_param_0.pad_w), stride_h(packed_param_0.stride_h), stride_w(packed_param_0.stride_w), dilate_h(packed_param_0.dilate_h), dilate_w(packed_param_0.dilate_w), window_h(packed_param_0.window_h), window_w(packed_param_0.window_w) {}
    ::megdnn::param::Images2Neibs param() const {
        return {pad_h, pad_w, stride_h, stride_w, dilate_h, dilate_w, window_h, window_w};
    }
};

class IncrMeshIndexing : public OpDefImplBase<IncrMeshIndexing> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items;
    IncrMeshIndexing() = default;
    IncrMeshIndexing(std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items_, std::string scope_ = {}): items(items_) { set_scope(scope_); }
};

class IncrSubtensor : public OpDefImplBase<IncrSubtensor> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items;
    IncrSubtensor() = default;
    IncrSubtensor(std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items_, std::string scope_ = {}): items(items_) { set_scope(scope_); }
};

class IndexingIncrMultiAxisVec : public OpDefImplBase<IndexingIncrMultiAxisVec> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items;
    IndexingIncrMultiAxisVec() = default;
    IndexingIncrMultiAxisVec(std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items_, std::string scope_ = {}): items(items_) { set_scope(scope_); }
};

class IndexingMultiAxisVec : public OpDefImplBase<IndexingMultiAxisVec> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items;
    IndexingMultiAxisVec() = default;
    IndexingMultiAxisVec(std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items_, std::string scope_ = {}): items(items_) { set_scope(scope_); }
};

class IndexingOneHot : public OpDefImplBase<IndexingOneHot> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    int32_t axis = 0;
    int32_t ndim;
    IndexingOneHot() = default;
    IndexingOneHot(int32_t axis_, int32_t ndim_, std::string scope_ = {}): axis(axis_), ndim(ndim_) { set_scope(scope_); }
    IndexingOneHot(::megdnn::param::Axis packed_param_0, int32_t ndim_): axis(packed_param_0.axis), ndim(ndim_) {}
    ::megdnn::param::Axis param() const {
        return {axis};
    }
};

class IndexingSetMultiAxisVec : public OpDefImplBase<IndexingSetMultiAxisVec> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items;
    IndexingSetMultiAxisVec() = default;
    IndexingSetMultiAxisVec(std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items_, std::string scope_ = {}): items(items_) { set_scope(scope_); }
};

class IndexingSetOneHot : public OpDefImplBase<IndexingSetOneHot> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    int32_t axis = 0;
    int32_t ndim;
    IndexingSetOneHot() = default;
    IndexingSetOneHot(int32_t axis_, int32_t ndim_, std::string scope_ = {}): axis(axis_), ndim(ndim_) { set_scope(scope_); }
    IndexingSetOneHot(::megdnn::param::Axis packed_param_0, int32_t ndim_): axis(packed_param_0.axis), ndim(ndim_) {}
    ::megdnn::param::Axis param() const {
        return {axis};
    }
};

class InplaceAdd : public OpDefImplBase<InplaceAdd> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    InplaceAdd() = default;
    InplaceAdd(::megdnn::param::Empty) {}
    ::megdnn::param::Empty param() const {
        return {};
    }
};

1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202
class InstanceNorm : public OpDefImplBase<InstanceNorm> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Format = ::megdnn::param::GroupNorm::Format;
    bool affine = true;
    float eps = 1e-5f;
    uint32_t group = 1;
    Format format = ::megdnn::param::GroupNorm::Format::NCHW;
    InstanceNorm() = default;
    InstanceNorm(bool affine_, float eps_, uint32_t group_, Format format_, std::string scope_ = {}): affine(affine_), eps(eps_), group(group_), format(format_) { set_scope(scope_); }
    InstanceNorm(::megdnn::param::GroupNorm packed_param_0): affine(packed_param_0.affine), eps(packed_param_0.eps), group(packed_param_0.group), format(packed_param_0.format) {}
    ::megdnn::param::GroupNorm param() const {
        return {affine, eps, group, format};
    }
};

1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323
class LAMBUpdate : public OpDefImplBase<LAMBUpdate> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    float beta_1 = 1.f;
    float beta_2 = 1.f;
    float step = 1.f;
    float lr = 1.f;
    float weight_decay = 1.f;
    float eps = 1.f;
    bool bias_correction = true;
    bool always_adapt = false;
    LAMBUpdate() = default;
    LAMBUpdate(float beta_1_, float beta_2_, float step_, float lr_, float weight_decay_, float eps_, bool bias_correction_, bool always_adapt_, std::string scope_ = {}): beta_1(beta_1_), beta_2(beta_2_), step(step_), lr(lr_), weight_decay(weight_decay_), eps(eps_), bias_correction(bias_correction_), always_adapt(always_adapt_) { set_scope(scope_); }
    LAMBUpdate(::megdnn::param::LAMBUpdate packed_param_0): beta_1(packed_param_0.beta_1), beta_2(packed_param_0.beta_2), step(packed_param_0.step), lr(packed_param_0.lr), weight_decay(packed_param_0.weight_decay), eps(packed_param_0.eps), bias_correction(packed_param_0.bias_correction), always_adapt(packed_param_0.always_adapt) {}
    ::megdnn::param::LAMBUpdate param() const {
        return {beta_1, beta_2, step, lr, weight_decay, eps, bias_correction, always_adapt};
    }
};

class LRN : public OpDefImplBase<LRN> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    uint32_t n = 5;
    float k = 2.f;
    float alpha = 1e-4f;
    float beta = 0.75f;
    LRN() = default;
    LRN(uint32_t n_, float k_, float alpha_, float beta_, std::string scope_ = {}): n(n_), k(k_), alpha(alpha_), beta(beta_) { set_scope(scope_); }
    LRN(::megdnn::param::LRN packed_param_0): n(packed_param_0.n), k(packed_param_0.k), alpha(packed_param_0.alpha), beta(packed_param_0.beta) {}
    ::megdnn::param::LRN param() const {
        return {n, k, alpha, beta};
    }
};

class LSQ : public OpDefImplBase<LSQ> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    int32_t qmin = -2147483648;
    int32_t qmax = 2147483647;
    LSQ() = default;
    LSQ(int32_t qmin_, int32_t qmax_, std::string scope_ = {}): qmin(qmin_), qmax(qmax_) { set_scope(scope_); }
    LSQ(::megdnn::param::LSQ packed_param_0): qmin(packed_param_0.qmin), qmax(packed_param_0.qmax) {}
    ::megdnn::param::LSQ param() const {
        return {qmin, qmax};
    }
};

class LSTM : public OpDefImplBase<LSTM> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using FwdMode = ::megdnn::param::LSTM::FwdMode;
    uint32_t num_layers = 1;
    bool bidirectional = false;
    bool bias = true;
    uint32_t hidden_size = 128;
    uint32_t proj_size = 0;
    float dropout = 0.f;
    FwdMode fwd_mode = ::megdnn::param::LSTM::FwdMode::TRAINING;
    LSTM() = default;
    LSTM(uint32_t num_layers_, bool bidirectional_, bool bias_, uint32_t hidden_size_, uint32_t proj_size_, float dropout_, FwdMode fwd_mode_, std::string scope_ = {}): num_layers(num_layers_), bidirectional(bidirectional_), bias(bias_), hidden_size(hidden_size_), proj_size(proj_size_), dropout(dropout_), fwd_mode(fwd_mode_) { set_scope(scope_); }
    LSTM(::megdnn::param::LSTM packed_param_0): num_layers(packed_param_0.num_layers), bidirectional(packed_param_0.bidirectional), bias(packed_param_0.bias), hidden_size(packed_param_0.hidden_size), proj_size(packed_param_0.proj_size), dropout(packed_param_0.dropout), fwd_mode(packed_param_0.fwd_mode) {}
    ::megdnn::param::LSTM param() const {
        return {num_layers, bidirectional, bias, hidden_size, proj_size, dropout, fwd_mode};
    }
};

class LSTMCell : public OpDefImplBase<LSTMCell> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    LSTMCell() = default;
    LSTMCell(::megdnn::param::Empty) {}
    ::megdnn::param::Empty param() const {
        return {};
    }
};

class LayerNorm : public OpDefImplBase<LayerNorm> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    bool affine = true;
    float eps = 1e-5f;
    uint64_t normalized_dim = 1;
    uint64_t normalized_size = 1;
    LayerNorm() = default;
    LayerNorm(bool affine_, float eps_, uint64_t normalized_dim_, uint64_t normalized_size_, std::string scope_ = {}): affine(affine_), eps(eps_), normalized_dim(normalized_dim_), normalized_size(normalized_size_) { set_scope(scope_); }
    LayerNorm(::megdnn::param::LayerNorm packed_param_0): affine(packed_param_0.affine), eps(packed_param_0.eps), normalized_dim(packed_param_0.normalized_dim), normalized_size(packed_param_0.normalized_size) {}
    ::megdnn::param::LayerNorm param() const {
        return {affine, eps, normalized_dim, normalized_size};
    }
};

class Linspace : public OpDefImplBase<Linspace> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    bool endpoint = true;
    ::mgb::CompNode comp_node;
    Linspace() = default;
    Linspace(bool endpoint_, ::mgb::CompNode comp_node_, std::string scope_ = {}): endpoint(endpoint_), comp_node(comp_node_) { set_scope(scope_); }
    Linspace(::megdnn::param::Linspace packed_param_0, ::mgb::CompNode comp_node_): endpoint(packed_param_0.endpoint), comp_node(comp_node_) {}
    ::megdnn::param::Linspace param() const {
        return {endpoint};
    }
};

class MagicMindRuntime : public OpDefImplBase<MagicMindRuntime> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::string buf;
    size_t buf_size;
    MagicMindRuntime() = default;
    MagicMindRuntime(std::string buf_, size_t buf_size_, std::string scope_ = {}): buf(buf_), buf_size(buf_size_) { set_scope(scope_); }
};

M
Megvii Engine Team 已提交
1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336
class MaskedFill : public OpDefImplBase<MaskedFill> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    float value = 0;
    MaskedFill() = default;
    MaskedFill(float value_, std::string scope_ = {}): value(value_) { set_scope(scope_); }
    MaskedFill(::megdnn::param::Fill packed_param_0): value(packed_param_0.value) {}
    ::megdnn::param::Fill param() const {
        return {value};
    }
};

1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378
class MatrixInverse : public OpDefImplBase<MatrixInverse> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    MatrixInverse() = default;
    MatrixInverse(::megdnn::param::Empty) {}
    ::megdnn::param::Empty param() const {
        return {};
    }
};

class MatrixMul : public OpDefImplBase<MatrixMul> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using ComputeMode = ::megdnn::param::MatrixMul::ComputeMode;
    using Format = ::megdnn::param::MatrixMul::Format;
    using Strategy = ::megdnn::param::ExecutionPolicy::Strategy;
    bool transposeA = false;
    bool transposeB = false;
    ComputeMode compute_mode = ::megdnn::param::MatrixMul::ComputeMode::DEFAULT;
    Format format = ::megdnn::param::MatrixMul::Format::DEFAULT;
    Strategy strategy = static_cast<::megdnn::param::ExecutionPolicy::Strategy>(1);
    uint64_t workspace_limit = 18446744073709551615ull;
    uint32_t dimA;
    uint32_t dimB;
    MatrixMul() = default;
    MatrixMul(bool transposeA_, bool transposeB_, ComputeMode compute_mode_, Format format_, Strategy strategy_, uint64_t workspace_limit_, uint32_t dimA_, uint32_t dimB_, std::string scope_ = {}): transposeA(transposeA_), transposeB(transposeB_), compute_mode(compute_mode_), format(format_), strategy(strategy_), workspace_limit(workspace_limit_), dimA(dimA_), dimB(dimB_) {
        set_scope(scope_);
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    MatrixMul(::megdnn::param::MatrixMul packed_param_0, ::megdnn::param::ExecutionPolicy packed_param_1, uint32_t dimA_, uint32_t dimB_): transposeA(packed_param_0.transposeA), transposeB(packed_param_0.transposeB), compute_mode(packed_param_0.compute_mode), format(packed_param_0.format), strategy(packed_param_1.strategy), workspace_limit(packed_param_1.workspace_limit), dimA(dimA_), dimB(dimB_) {
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    ::megdnn::param::MatrixMul param() const {
        return {transposeA, transposeB, compute_mode, format};
    }
    ::megdnn::param::ExecutionPolicy policy() const {
        return {strategy, workspace_limit};
    }
};

1379 1380 1381 1382 1383 1384 1385 1386 1387
class MeshGrid : public OpDefImplBase<MeshGrid> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::string indexing;
    MeshGrid() = default;
    MeshGrid(std::string indexing_, std::string scope_ = {}): indexing(indexing_) { set_scope(scope_); }
};

1388 1389 1390 1391 1392 1393 1394 1395 1396
class MeshIndexing : public OpDefImplBase<MeshIndexing> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items;
    MeshIndexing() = default;
    MeshIndexing(std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items_, std::string scope_ = {}): items(items_) { set_scope(scope_); }
};

1397 1398 1399 1400
class MultiHeadAttn : public OpDefImplBase<MultiHeadAttn> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
1401 1402
    using AttnMaskType = ::megdnn::param::MultiHeadAttn::AttnMaskType;
    using TensorCombinationType = ::megdnn::param::MultiHeadAttn::TensorCombinationType;
1403
    uint32_t num_heads = 1;
1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414
    uint32_t embeding_size = 0;
    uint32_t k_size = 0;
    uint32_t v_size = 0;
    uint32_t qproj_size = 0;
    uint32_t kproj_size = 0;
    uint32_t vproj_size = 0;
    uint32_t oproj_size = 0;
    bool qbias = false;
    bool kbias = false;
    bool vbias = false;
    bool obias = false;
1415 1416
    float sm_scaler = 1.f;
    uint32_t input_order = 0;
1417 1418
    AttnMaskType attn_mask_type = ::megdnn::param::MultiHeadAttn::AttnMaskType::NO_MASK;
    TensorCombinationType tensor_combination_type = ::megdnn::param::MultiHeadAttn::TensorCombinationType::NONE;
1419
    bool add_zero_attn = false;
1420
    bool need_weights = false;
1421 1422 1423 1424 1425 1426 1427
    bool reslink = false;
    bool training = true;
    uint64_t seed = 0;
    float attn_prob = 0.f;
    float out_prob = 0.f;
    size_t handle;
    MultiHeadAttn() = default;
1428
    MultiHeadAttn(uint32_t num_heads_, uint32_t embeding_size_, uint32_t k_size_, uint32_t v_size_, uint32_t qproj_size_, uint32_t kproj_size_, uint32_t vproj_size_, uint32_t oproj_size_, bool qbias_, bool kbias_, bool vbias_, bool obias_, float sm_scaler_, uint32_t input_order_, AttnMaskType attn_mask_type_, TensorCombinationType tensor_combination_type_, bool add_zero_attn_, bool need_weights_, bool reslink_, bool training_, uint64_t seed_, float attn_prob_, float out_prob_, size_t handle_, std::string scope_ = {}): num_heads(num_heads_), embeding_size(embeding_size_), k_size(k_size_), v_size(v_size_), qproj_size(qproj_size_), kproj_size(kproj_size_), vproj_size(vproj_size_), oproj_size(oproj_size_), qbias(qbias_), kbias(kbias_), vbias(vbias_), obias(obias_), sm_scaler(sm_scaler_), input_order(input_order_), attn_mask_type(attn_mask_type_), tensor_combination_type(tensor_combination_type_), add_zero_attn(add_zero_attn_), need_weights(need_weights_), reslink(reslink_), training(training_), seed(seed_), attn_prob(attn_prob_), out_prob(out_prob_), handle(handle_) { set_scope(scope_); }
1429
    MultiHeadAttn(::megdnn::param::MultiHeadAttn packed_param_0, size_t handle_): num_heads(packed_param_0.num_heads), embeding_size(packed_param_0.embeding_size), k_size(packed_param_0.k_size), v_size(packed_param_0.v_size), qproj_size(packed_param_0.qproj_size), kproj_size(packed_param_0.kproj_size), vproj_size(packed_param_0.vproj_size), oproj_size(packed_param_0.oproj_size), qbias(packed_param_0.qbias), kbias(packed_param_0.kbias), vbias(packed_param_0.vbias), obias(packed_param_0.obias), sm_scaler(packed_param_0.sm_scaler), input_order(packed_param_0.input_order), attn_mask_type(packed_param_0.attn_mask_type), tensor_combination_type(packed_param_0.tensor_combination_type), add_zero_attn(packed_param_0.add_zero_attn), need_weights(packed_param_0.need_weights), reslink(packed_param_0.reslink), training(packed_param_0.training), seed(packed_param_0.seed), attn_prob(packed_param_0.attn_prob), out_prob(packed_param_0.out_prob), handle(handle_) {}
1430
    ::megdnn::param::MultiHeadAttn param() const {
1431
        return {num_heads, embeding_size, k_size, v_size, qproj_size, kproj_size, vproj_size, oproj_size, qbias, kbias, vbias, obias, sm_scaler, input_order, attn_mask_type, tensor_combination_type, add_zero_attn, need_weights, reslink, training, seed, attn_prob, out_prob};
1432 1433 1434
    }
};

1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671
class NMSKeep : public OpDefImplBase<NMSKeep> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    float iou_thresh;
    uint32_t max_output;
    NMSKeep() = default;
    NMSKeep(float iou_thresh_, uint32_t max_output_, std::string scope_ = {}): iou_thresh(iou_thresh_), max_output(max_output_) { set_scope(scope_); }
};

class NvOf : public OpDefImplBase<NvOf> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    uint32_t precision = 1;
    NvOf() = default;
    NvOf(uint32_t precision_, std::string scope_ = {}): precision(precision_) { set_scope(scope_); }
    NvOf(::megdnn::param::NvOf packed_param_0): precision(packed_param_0.precision) {}
    ::megdnn::param::NvOf param() const {
        return {precision};
    }
};

class Padding : public OpDefImplBase<Padding> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using PaddingMode = ::megdnn::param::Padding::PaddingMode;
    uint32_t front_offset_dim0 = 0;
    uint32_t front_offset_dim1 = 0;
    uint32_t front_offset_dim2 = 0;
    uint32_t front_offset_dim3 = 0;
    uint32_t front_offset_dim4 = 0;
    uint32_t front_offset_dim5 = 0;
    uint32_t front_offset_dim6 = 0;
    uint32_t back_offset_dim0 = 0;
    uint32_t back_offset_dim1 = 0;
    uint32_t back_offset_dim2 = 0;
    uint32_t back_offset_dim3 = 0;
    uint32_t back_offset_dim4 = 0;
    uint32_t back_offset_dim5 = 0;
    uint32_t back_offset_dim6 = 0;
    float padding_val = 0;
    PaddingMode padding_mode = ::megdnn::param::Padding::PaddingMode::CONSTANT;
    Padding() = default;
    Padding(uint32_t front_offset_dim0_, uint32_t front_offset_dim1_, uint32_t front_offset_dim2_, uint32_t front_offset_dim3_, uint32_t front_offset_dim4_, uint32_t front_offset_dim5_, uint32_t front_offset_dim6_, uint32_t back_offset_dim0_, uint32_t back_offset_dim1_, uint32_t back_offset_dim2_, uint32_t back_offset_dim3_, uint32_t back_offset_dim4_, uint32_t back_offset_dim5_, uint32_t back_offset_dim6_, float padding_val_, PaddingMode padding_mode_, std::string scope_ = {}): front_offset_dim0(front_offset_dim0_), front_offset_dim1(front_offset_dim1_), front_offset_dim2(front_offset_dim2_), front_offset_dim3(front_offset_dim3_), front_offset_dim4(front_offset_dim4_), front_offset_dim5(front_offset_dim5_), front_offset_dim6(front_offset_dim6_), back_offset_dim0(back_offset_dim0_), back_offset_dim1(back_offset_dim1_), back_offset_dim2(back_offset_dim2_), back_offset_dim3(back_offset_dim3_), back_offset_dim4(back_offset_dim4_), back_offset_dim5(back_offset_dim5_), back_offset_dim6(back_offset_dim6_), padding_val(padding_val_), padding_mode(padding_mode_) { set_scope(scope_); }
    Padding(::megdnn::param::Padding packed_param_0): front_offset_dim0(packed_param_0.front_offset_dim0), front_offset_dim1(packed_param_0.front_offset_dim1), front_offset_dim2(packed_param_0.front_offset_dim2), front_offset_dim3(packed_param_0.front_offset_dim3), front_offset_dim4(packed_param_0.front_offset_dim4), front_offset_dim5(packed_param_0.front_offset_dim5), front_offset_dim6(packed_param_0.front_offset_dim6), back_offset_dim0(packed_param_0.back_offset_dim0), back_offset_dim1(packed_param_0.back_offset_dim1), back_offset_dim2(packed_param_0.back_offset_dim2), back_offset_dim3(packed_param_0.back_offset_dim3), back_offset_dim4(packed_param_0.back_offset_dim4), back_offset_dim5(packed_param_0.back_offset_dim5), back_offset_dim6(packed_param_0.back_offset_dim6), padding_val(packed_param_0.padding_val), padding_mode(packed_param_0.padding_mode) {}
    ::megdnn::param::Padding param() const {
        return {front_offset_dim0, front_offset_dim1, front_offset_dim2, front_offset_dim3, front_offset_dim4, front_offset_dim5, front_offset_dim6, back_offset_dim0, back_offset_dim1, back_offset_dim2, back_offset_dim3, back_offset_dim4, back_offset_dim5, back_offset_dim6, padding_val, padding_mode};
    }
};

class ParamPackConcat : public OpDefImplBase<ParamPackConcat> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<int32_t> offsets;
    ParamPackConcat() = default;
    ParamPackConcat(std::vector<int32_t> offsets_, std::string scope_ = {}): offsets(offsets_) { set_scope(scope_); }
};

class ParamPackSplit : public OpDefImplBase<ParamPackSplit> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<int32_t> offsets;
    std::vector<std::vector<size_t>> shapes;
    ParamPackSplit() = default;
    ParamPackSplit(std::vector<int32_t> offsets_, std::vector<std::vector<size_t>> shapes_, std::string scope_ = {}): offsets(offsets_), shapes(shapes_) { set_scope(scope_); }
};

class PermutationRNG : public OpDefImplBase<PermutationRNG> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    uint64_t seed = 0;
    ::megdnn::DType dtype = megdnn::DType::from_enum(megdnn::DTypeEnum::Int32);
    size_t handle;
    PermutationRNG() = default;
    PermutationRNG(uint64_t seed_, ::megdnn::DType dtype_, size_t handle_, std::string scope_ = {}): seed(seed_), dtype(dtype_), handle(handle_) { set_scope(scope_); }
};

class PixelShuffle : public OpDefImplBase<PixelShuffle> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    int32_t factor;
    PixelShuffle() = default;
    PixelShuffle(int32_t factor_, std::string scope_ = {}): factor(factor_) { set_scope(scope_); }
};

class PixelShuffleBackward : public OpDefImplBase<PixelShuffleBackward> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    int32_t factor;
    PixelShuffleBackward() = default;
    PixelShuffleBackward(int32_t factor_, std::string scope_ = {}): factor(factor_) { set_scope(scope_); }
};

class PoissonRNG : public OpDefImplBase<PoissonRNG> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    uint64_t seed = 0;
    size_t handle;
    PoissonRNG() = default;
    PoissonRNG(uint64_t seed_, size_t handle_, std::string scope_ = {}): seed(seed_), handle(handle_) { set_scope(scope_); }
    PoissonRNG(::megdnn::param::PoissonRNG packed_param_0, size_t handle_): seed(packed_param_0.seed), handle(handle_) {}
    ::megdnn::param::PoissonRNG param() const {
        return {seed};
    }
};

class Pooling : public OpDefImplBase<Pooling> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Mode = ::megdnn::param::Pooling::Mode;
    using Format = ::megdnn::param::Pooling::Format;
    using Strategy = ::megdnn::param::ExecutionPolicy::Strategy;
    Mode mode = ::megdnn::param::Pooling::Mode::MAX;
    uint32_t pad_h = 0;
    uint32_t pad_w = 0;
    uint32_t stride_h = 2;
    uint32_t stride_w = 2;
    uint32_t window_h = 2;
    uint32_t window_w = 2;
    Format format = ::megdnn::param::Pooling::Format::NCHW;
    Strategy strategy = static_cast<::megdnn::param::ExecutionPolicy::Strategy>(1);
    uint64_t workspace_limit = 18446744073709551615ull;
    Pooling() = default;
    Pooling(Mode mode_, uint32_t pad_h_, uint32_t pad_w_, uint32_t stride_h_, uint32_t stride_w_, uint32_t window_h_, uint32_t window_w_, Format format_, Strategy strategy_, uint64_t workspace_limit_, std::string scope_ = {}): mode(mode_), pad_h(pad_h_), pad_w(pad_w_), stride_h(stride_h_), stride_w(stride_w_), window_h(window_h_), window_w(window_w_), format(format_), strategy(strategy_), workspace_limit(workspace_limit_) {
        set_scope(scope_);
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    Pooling(::megdnn::param::Pooling packed_param_0, ::megdnn::param::ExecutionPolicy packed_param_1): mode(packed_param_0.mode), pad_h(packed_param_0.pad_h), pad_w(packed_param_0.pad_w), stride_h(packed_param_0.stride_h), stride_w(packed_param_0.stride_w), window_h(packed_param_0.window_h), window_w(packed_param_0.window_w), format(packed_param_0.format), strategy(packed_param_1.strategy), workspace_limit(packed_param_1.workspace_limit) {
        mgb_assert(static_cast<uint32_t>(strategy) <= uint32_t(8));
    }
    ::megdnn::param::Pooling param() const {
        return {mode, pad_h, pad_w, stride_h, stride_w, window_h, window_w, format};
    }
    ::megdnn::param::ExecutionPolicy policy() const {
        return {strategy, workspace_limit};
    }
};

class RNN : public OpDefImplBase<RNN> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using NonlineMode = ::megdnn::param::RNN::NonlineMode;
    using FwdMode = ::megdnn::param::RNN::FwdMode;
    uint32_t num_layers = 1;
    bool bidirectional = false;
    bool bias = true;
    uint32_t hidden_size = 128;
    float dropout = 0.f;
    NonlineMode nonlineMode = ::megdnn::param::RNN::NonlineMode::IDENTITY;
    FwdMode fwd_mode = ::megdnn::param::RNN::FwdMode::TRAINING;
    RNN() = default;
    RNN(uint32_t num_layers_, bool bidirectional_, bool bias_, uint32_t hidden_size_, float dropout_, NonlineMode nonlineMode_, FwdMode fwd_mode_, std::string scope_ = {}): num_layers(num_layers_), bidirectional(bidirectional_), bias(bias_), hidden_size(hidden_size_), dropout(dropout_), nonlineMode(nonlineMode_), fwd_mode(fwd_mode_) { set_scope(scope_); }
    RNN(::megdnn::param::RNN packed_param_0): num_layers(packed_param_0.num_layers), bidirectional(packed_param_0.bidirectional), bias(packed_param_0.bias), hidden_size(packed_param_0.hidden_size), dropout(packed_param_0.dropout), nonlineMode(packed_param_0.nonlineMode), fwd_mode(packed_param_0.fwd_mode) {}
    ::megdnn::param::RNN param() const {
        return {num_layers, bidirectional, bias, hidden_size, dropout, nonlineMode, fwd_mode};
    }
};

class RNNCell : public OpDefImplBase<RNNCell> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using NonlineMode = ::megdnn::param::RNNCell::NonlineMode;
    NonlineMode nonlineMode = ::megdnn::param::RNNCell::NonlineMode::IDENTITY;
    RNNCell() = default;
    RNNCell(NonlineMode nonlineMode_, std::string scope_ = {}): nonlineMode(nonlineMode_) { set_scope(scope_); }
    RNNCell(::megdnn::param::RNNCell packed_param_0): nonlineMode(packed_param_0.nonlineMode) {}
    ::megdnn::param::RNNCell param() const {
        return {nonlineMode};
    }
};

class ROIAlign : public OpDefImplBase<ROIAlign> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Mode = ::megdnn::param::ROIAlign::Mode;
    using Format = ::megdnn::param::ROIAlign::Format;
    Mode mode = ::megdnn::param::ROIAlign::Mode::MAX;
    Format format = ::megdnn::param::ROIAlign::Format::NCHW;
    float spatial_scale = 1.0;
    float offset = 0.0;
    uint32_t pooled_height = 1;
    uint32_t pooled_width = 1;
    uint32_t sample_height = 2;
    uint32_t sample_width = 2;
    ROIAlign() = default;
    ROIAlign(Mode mode_, Format format_, float spatial_scale_, float offset_, uint32_t pooled_height_, uint32_t pooled_width_, uint32_t sample_height_, uint32_t sample_width_, std::string scope_ = {}): mode(mode_), format(format_), spatial_scale(spatial_scale_), offset(offset_), pooled_height(pooled_height_), pooled_width(pooled_width_), sample_height(sample_height_), sample_width(sample_width_) { set_scope(scope_); }
    ROIAlign(::megdnn::param::ROIAlign packed_param_0): mode(packed_param_0.mode), format(packed_param_0.format), spatial_scale(packed_param_0.spatial_scale), offset(packed_param_0.offset), pooled_height(packed_param_0.pooled_height), pooled_width(packed_param_0.pooled_width), sample_height(packed_param_0.sample_height), sample_width(packed_param_0.sample_width) {}
    ::megdnn::param::ROIAlign param() const {
        return {mode, format, spatial_scale, offset, pooled_height, pooled_width, sample_height, sample_width};
    }
};

class ROIPooling : public OpDefImplBase<ROIPooling> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Mode = ::megdnn::param::ROIPooling::Mode;
    Mode mode = ::megdnn::param::ROIPooling::Mode::MAX;
    float scale = 1.f;
    ROIPooling() = default;
    ROIPooling(Mode mode_, float scale_, std::string scope_ = {}): mode(mode_), scale(scale_) { set_scope(scope_); }
    ROIPooling(::megdnn::param::ROIPooling packed_param_0): mode(packed_param_0.mode), scale(packed_param_0.scale) {}
    ::megdnn::param::ROIPooling param() const {
        return {mode, scale};
    }
};

class Reduce : public OpDefImplBase<Reduce> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Mode = ::megdnn::param::Reduce::Mode;
    using DataType = ::megdnn::param::Reduce::DataType;
    Mode mode = ::megdnn::param::Reduce::Mode::SUM;
    int32_t axis = 2147483647;
    DataType data_type = ::megdnn::param::Reduce::DataType::DEFAULT;
    bool keepdim = true;
    Reduce() = default;
    Reduce(Mode mode_, int32_t axis_, DataType data_type_, bool keepdim_, std::string scope_ = {}): mode(mode_), axis(axis_), data_type(data_type_), keepdim(keepdim_) { set_scope(scope_); }
    Reduce(::megdnn::param::Reduce packed_param_0, bool keepdim_): mode(packed_param_0.mode), axis(packed_param_0.axis), data_type(packed_param_0.data_type), keepdim(keepdim_) {}
    ::megdnn::param::Reduce param() const {
        return {mode, axis, data_type};
    }
};

1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723
class RegionRestrictedConvolution : public OpDefImplBase<RegionRestrictedConvolution> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Mode = ::megdnn::param::Convolution::Mode;
    using Sparse = ::megdnn::param::Convolution::Sparse;
    using Format = ::megdnn::param::Convolution::Format;
    using ComputeMode = ::megdnn::param::Convolution::ComputeMode;
    Mode mode = ::megdnn::param::Convolution::Mode::CROSS_CORRELATION;
    uint32_t pad_h = 0;
    uint32_t pad_w = 0;
    uint32_t stride_h = 1;
    uint32_t stride_w = 1;
    uint32_t dilate_h = 1;
    uint32_t dilate_w = 1;
    Sparse sparse = ::megdnn::param::Convolution::Sparse::DENSE;
    Format format = ::megdnn::param::Convolution::Format::NCHW;
    ComputeMode compute_mode = ::megdnn::param::Convolution::ComputeMode::DEFAULT;
    RegionRestrictedConvolution() = default;
    RegionRestrictedConvolution(Mode mode_, uint32_t pad_h_, uint32_t pad_w_, uint32_t stride_h_, uint32_t stride_w_, uint32_t dilate_h_, uint32_t dilate_w_, Sparse sparse_, Format format_, ComputeMode compute_mode_, std::string scope_ = {}): mode(mode_), pad_h(pad_h_), pad_w(pad_w_), stride_h(stride_h_), stride_w(stride_w_), dilate_h(dilate_h_), dilate_w(dilate_w_), sparse(sparse_), format(format_), compute_mode(compute_mode_) { set_scope(scope_); }
    RegionRestrictedConvolution(::megdnn::param::Convolution packed_param_0): mode(packed_param_0.mode), pad_h(packed_param_0.pad_h), pad_w(packed_param_0.pad_w), stride_h(packed_param_0.stride_h), stride_w(packed_param_0.stride_w), dilate_h(packed_param_0.dilate_h), dilate_w(packed_param_0.dilate_w), sparse(packed_param_0.sparse), format(packed_param_0.format), compute_mode(packed_param_0.compute_mode) {}
    ::megdnn::param::Convolution param() const {
        return {mode, pad_h, pad_w, stride_h, stride_w, dilate_h, dilate_w, sparse, format, compute_mode};
    }
};

class RegionRestrictedConvolutionBackwardData : public OpDefImplBase<RegionRestrictedConvolutionBackwardData> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Mode = ::megdnn::param::Convolution::Mode;
    using Sparse = ::megdnn::param::Convolution::Sparse;
    using Format = ::megdnn::param::Convolution::Format;
    using ComputeMode = ::megdnn::param::Convolution::ComputeMode;
    Mode mode = ::megdnn::param::Convolution::Mode::CROSS_CORRELATION;
    uint32_t pad_h = 0;
    uint32_t pad_w = 0;
    uint32_t stride_h = 1;
    uint32_t stride_w = 1;
    uint32_t dilate_h = 1;
    uint32_t dilate_w = 1;
    Sparse sparse = ::megdnn::param::Convolution::Sparse::DENSE;
    Format format = ::megdnn::param::Convolution::Format::NCHW;
    ComputeMode compute_mode = ::megdnn::param::Convolution::ComputeMode::DEFAULT;
    RegionRestrictedConvolutionBackwardData() = default;
    RegionRestrictedConvolutionBackwardData(Mode mode_, uint32_t pad_h_, uint32_t pad_w_, uint32_t stride_h_, uint32_t stride_w_, uint32_t dilate_h_, uint32_t dilate_w_, Sparse sparse_, Format format_, ComputeMode compute_mode_, std::string scope_ = {}): mode(mode_), pad_h(pad_h_), pad_w(pad_w_), stride_h(stride_h_), stride_w(stride_w_), dilate_h(dilate_h_), dilate_w(dilate_w_), sparse(sparse_), format(format_), compute_mode(compute_mode_) { set_scope(scope_); }
    RegionRestrictedConvolutionBackwardData(::megdnn::param::Convolution packed_param_0): mode(packed_param_0.mode), pad_h(packed_param_0.pad_h), pad_w(packed_param_0.pad_w), stride_h(packed_param_0.stride_h), stride_w(packed_param_0.stride_w), dilate_h(packed_param_0.dilate_h), dilate_w(packed_param_0.dilate_w), sparse(packed_param_0.sparse), format(packed_param_0.format), compute_mode(packed_param_0.compute_mode) {}
    ::megdnn::param::Convolution param() const {
        return {mode, pad_h, pad_w, stride_h, stride_w, dilate_h, dilate_w, sparse, format, compute_mode};
    }
};

1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810
class Remap : public OpDefImplBase<Remap> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using InterpolationMode = ::megdnn::param::Remap::InterpolationMode;
    using BorderMode = ::megdnn::param::Remap::BorderMode;
    using Format = ::megdnn::param::Remap::Format;
    InterpolationMode imode = ::megdnn::param::Remap::InterpolationMode::LINEAR;
    BorderMode border_type = ::megdnn::param::Remap::BorderMode::REPLICATE;
    Format format = ::megdnn::param::Remap::Format::NHWC;
    float scalar = 0.f;
    Remap() = default;
    Remap(InterpolationMode imode_, BorderMode border_type_, Format format_, float scalar_, std::string scope_ = {}): imode(imode_), border_type(border_type_), format(format_), scalar(scalar_) { set_scope(scope_); }
    Remap(::megdnn::param::Remap packed_param_0): imode(packed_param_0.imode), border_type(packed_param_0.border_type), format(packed_param_0.format), scalar(packed_param_0.scalar) {}
    ::megdnn::param::Remap param() const {
        return {imode, border_type, format, scalar};
    }
};

class RemoteRecv : public OpDefImplBase<RemoteRecv> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::string key;
    std::string addr;
    uint32_t port;
    uint32_t rank_from;
    ::mgb::CompNode cn;
    std::vector<int32_t> shape;
    ::megdnn::DType dtype;
    std::string backend;
    RemoteRecv() = default;
    RemoteRecv(std::string key_, std::string addr_, uint32_t port_, uint32_t rank_from_, ::mgb::CompNode cn_, std::vector<int32_t> shape_, ::megdnn::DType dtype_, std::string backend_, std::string scope_ = {}): key(key_), addr(addr_), port(port_), rank_from(rank_from_), cn(cn_), shape(shape_), dtype(dtype_), backend(backend_) { set_scope(scope_); }
};

class RemoteSend : public OpDefImplBase<RemoteSend> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::string key;
    std::string addr;
    uint32_t port;
    uint32_t rank_to;
    std::string backend;
    RemoteSend() = default;
    RemoteSend(std::string key_, std::string addr_, uint32_t port_, uint32_t rank_to_, std::string backend_, std::string scope_ = {}): key(key_), addr(addr_), port(port_), rank_to(rank_to_), backend(backend_) { set_scope(scope_); }
};

class RemoveAxis : public OpDefImplBase<RemoveAxis> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<int32_t> axis;
    RemoveAxis() = default;
    RemoveAxis(std::vector<int32_t> axis_, std::string scope_ = {}): axis(axis_) { set_scope(scope_); }
};

class Reshape : public OpDefImplBase<Reshape> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    int32_t axis = ::megdnn::param::OptionalAxisV1::INVALID_AXIS;
    std::vector<int32_t> shape;
    Reshape() = default;
    Reshape(int32_t axis_, std::vector<int32_t> shape_, std::string scope_ = {}): axis(axis_), shape(shape_) { set_scope(scope_); }
    Reshape(::megdnn::param::OptionalAxisV1 packed_param_0, std::vector<int32_t> shape_): axis(packed_param_0.axis), shape(shape_) {}
    ::megdnn::param::OptionalAxisV1 param() const {
        return {axis};
    }
};

class Resize : public OpDefImplBase<Resize> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using InterpolationMode = ::megdnn::param::Resize::InterpolationMode;
    using Format = ::megdnn::param::Resize::Format;
    InterpolationMode imode = ::megdnn::param::Resize::InterpolationMode::LINEAR;
    Format format = ::megdnn::param::Resize::Format::NHWC;
    Resize() = default;
    Resize(InterpolationMode imode_, Format format_, std::string scope_ = {}): imode(imode_), format(format_) { set_scope(scope_); }
    Resize(::megdnn::param::Resize packed_param_0): imode(packed_param_0.imode), format(packed_param_0.format) {}
    ::megdnn::param::Resize param() const {
        return {imode, format};
    }
};

1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827
class Resize3D : public OpDefImplBase<Resize3D> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using InterpolationMode = ::megdnn::param::Resize3D::InterpolationMode;
    using Format = ::megdnn::param::Resize3D::Format;
    InterpolationMode imode = ::megdnn::param::Resize3D::InterpolationMode::LINEAR;
    Format format = ::megdnn::param::Resize3D::Format::NDHWC;
    bool align_corners = false;
    Resize3D() = default;
    Resize3D(InterpolationMode imode_, Format format_, bool align_corners_, std::string scope_ = {}): imode(imode_), format(format_), align_corners(align_corners_) { set_scope(scope_); }
    Resize3D(::megdnn::param::Resize3D packed_param_0): imode(packed_param_0.imode), format(packed_param_0.format), align_corners(packed_param_0.align_corners) {}
    ::megdnn::param::Resize3D param() const {
        return {imode, format, align_corners};
    }
};

1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922
class SVD : public OpDefImplBase<SVD> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    bool full_matrices = false;
    bool compute_uv = true;
    SVD() = default;
    SVD(bool full_matrices_, bool compute_uv_, std::string scope_ = {}): full_matrices(full_matrices_), compute_uv(compute_uv_) { set_scope(scope_); }
    SVD(::megdnn::param::SVD packed_param_0): full_matrices(packed_param_0.full_matrices), compute_uv(packed_param_0.compute_uv) {}
    ::megdnn::param::SVD param() const {
        return {full_matrices, compute_uv};
    }
};

class SetMeshIndexing : public OpDefImplBase<SetMeshIndexing> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items;
    SetMeshIndexing() = default;
    SetMeshIndexing(std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items_, std::string scope_ = {}): items(items_) { set_scope(scope_); }
};

class SetSubtensor : public OpDefImplBase<SetSubtensor> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items;
    SetSubtensor() = default;
    SetSubtensor(std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items_, std::string scope_ = {}): items(items_) { set_scope(scope_); }
};

class ShuffleRNG : public OpDefImplBase<ShuffleRNG> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    uint64_t seed = 0;
    size_t handle;
    ShuffleRNG() = default;
    ShuffleRNG(uint64_t seed_, size_t handle_, std::string scope_ = {}): seed(seed_), handle(handle_) { set_scope(scope_); }
    ShuffleRNG(::megdnn::param::ShuffleRNG packed_param_0, size_t handle_): seed(packed_param_0.seed), handle(handle_) {}
    ::megdnn::param::ShuffleRNG param() const {
        return {seed};
    }
};

class SlidingWindowTranspose : public OpDefImplBase<SlidingWindowTranspose> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    uint32_t out_h = 0;
    uint32_t out_w = 0;
    uint32_t pad_h = 0;
    uint32_t pad_w = 0;
    uint32_t stride_h = 1;
    uint32_t stride_w = 1;
    uint32_t dilate_h = 1;
    uint32_t dilate_w = 1;
    uint32_t window_h = 3;
    uint32_t window_w = 3;
    SlidingWindowTranspose() = default;
    SlidingWindowTranspose(uint32_t out_h_, uint32_t out_w_, uint32_t pad_h_, uint32_t pad_w_, uint32_t stride_h_, uint32_t stride_w_, uint32_t dilate_h_, uint32_t dilate_w_, uint32_t window_h_, uint32_t window_w_, std::string scope_ = {}): out_h(out_h_), out_w(out_w_), pad_h(pad_h_), pad_w(pad_w_), stride_h(stride_h_), stride_w(stride_w_), dilate_h(dilate_h_), dilate_w(dilate_w_), window_h(window_h_), window_w(window_w_) { set_scope(scope_); }
    SlidingWindowTranspose(::megdnn::param::SlidingWindowTranspose packed_param_0): out_h(packed_param_0.out_h), out_w(packed_param_0.out_w), pad_h(packed_param_0.pad_h), pad_w(packed_param_0.pad_w), stride_h(packed_param_0.stride_h), stride_w(packed_param_0.stride_w), dilate_h(packed_param_0.dilate_h), dilate_w(packed_param_0.dilate_w), window_h(packed_param_0.window_h), window_w(packed_param_0.window_w) {}
    ::megdnn::param::SlidingWindowTranspose param() const {
        return {out_h, out_w, pad_h, pad_w, stride_h, stride_w, dilate_h, dilate_w, window_h, window_w};
    }
};

class Softmax : public OpDefImplBase<Softmax> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    int32_t axis = -1;
    Softmax() = default;
    Softmax(int32_t axis_, std::string scope_ = {}): axis(axis_) { set_scope(scope_); }
    Softmax(::megdnn::param::Softmax packed_param_0): axis(packed_param_0.axis) {}
    ::megdnn::param::Softmax param() const {
        return {axis};
    }
};

class Split : public OpDefImplBase<Split> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    int32_t axis;
    int32_t nsections;
    Split() = default;
    Split(int32_t axis_, int32_t nsections_, std::string scope_ = {}): axis(axis_), nsections(nsections_) { set_scope(scope_); }
    Split(::megdnn::param::Empty, int32_t axis_, int32_t nsections_): axis(axis_), nsections(nsections_) {}
    ::megdnn::param::Empty param() const {
        return {};
    }
};

1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936
class Stack : public OpDefImplBase<Stack> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    int32_t axis = 0;
    ::mgb::CompNode comp_node;
    Stack() = default;
    Stack(int32_t axis_, ::mgb::CompNode comp_node_, std::string scope_ = {}): axis(axis_), comp_node(comp_node_) { set_scope(scope_); }
    Stack(::megdnn::param::Axis packed_param_0, ::mgb::CompNode comp_node_): axis(packed_param_0.axis), comp_node(comp_node_) {}
    ::megdnn::param::Axis param() const {
        return {axis};
    }
};

1937 1938 1939 1940 1941
class Subtensor : public OpDefImplBase<Subtensor> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items;
1942
    std::vector<std::tuple<int32_t, int32_t, int32_t, int32_t>> slice_items;
1943
    Subtensor() = default;
1944
    Subtensor(std::vector<std::tuple<int8_t, bool, bool, bool, bool>> items_, std::vector<std::tuple<int32_t, int32_t, int32_t, int32_t>> slice_items_, std::string scope_ = {}): items(items_), slice_items(slice_items_) { set_scope(scope_); }
1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042
};

class TQT : public OpDefImplBase<TQT> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    int32_t qmin = -2147483648;
    int32_t qmax = 2147483647;
    TQT() = default;
    TQT(int32_t qmin_, int32_t qmax_, std::string scope_ = {}): qmin(qmin_), qmax(qmax_) { set_scope(scope_); }
    TQT(::megdnn::param::TQT packed_param_0): qmin(packed_param_0.qmin), qmax(packed_param_0.qmax) {}
    ::megdnn::param::TQT param() const {
        return {qmin, qmax};
    }
};

class TensorRTRuntime : public OpDefImplBase<TensorRTRuntime> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    std::string buf;
    size_t buf_size;
    TensorRTRuntime() = default;
    TensorRTRuntime(std::string buf_, size_t buf_size_, std::string scope_ = {}): buf(buf_), buf_size(buf_size_) { set_scope(scope_); }
};

class TopK : public OpDefImplBase<TopK> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using Mode = ::megdnn::param::TopK::Mode;
    Mode mode = ::megdnn::param::TopK::Mode::KTH_ONLY;
    TopK() = default;
    TopK(Mode mode_, std::string scope_ = {}): mode(mode_) { set_scope(scope_); }
    TopK(::megdnn::param::TopK packed_param_0): mode(packed_param_0.mode) {}
    ::megdnn::param::TopK param() const {
        return {mode};
    }
};

class TypeCvt : public OpDefImplBase<TypeCvt> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    ::megdnn::DType dtype;
    TypeCvt() = default;
    TypeCvt(::megdnn::DType dtype_, std::string scope_ = {}): dtype(dtype_) { set_scope(scope_); }
};

class UniformRNG : public OpDefImplBase<UniformRNG> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    uint64_t seed = 0;
    ::megdnn::DType dtype = megdnn::DType::from_enum(megdnn::DTypeEnum::Float32);
    size_t handle;
    UniformRNG() = default;
    UniformRNG(uint64_t seed_, ::megdnn::DType dtype_, size_t handle_, std::string scope_ = {}): seed(seed_), dtype(dtype_), handle(handle_) { set_scope(scope_); }
};

class WarpAffine : public OpDefImplBase<WarpAffine> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using InterpolationMode = ::megdnn::param::WarpAffine::InterpolationMode;
    using BorderMode = ::megdnn::param::WarpAffine::BorderMode;
    using Format = ::megdnn::param::WarpAffine::Format;
    InterpolationMode imode = ::megdnn::param::WarpAffine::InterpolationMode::LINEAR;
    BorderMode border_mode = ::megdnn::param::WarpAffine::BorderMode::REPLICATE;
    float border_val = .0f;
    Format format = ::megdnn::param::WarpAffine::Format::NHWC;
    WarpAffine() = default;
    WarpAffine(InterpolationMode imode_, BorderMode border_mode_, float border_val_, Format format_, std::string scope_ = {}): imode(imode_), border_mode(border_mode_), border_val(border_val_), format(format_) { set_scope(scope_); }
    WarpAffine(::megdnn::param::WarpAffine packed_param_0): imode(packed_param_0.imode), border_mode(packed_param_0.border_mode), border_val(packed_param_0.border_val), format(packed_param_0.format) {}
    ::megdnn::param::WarpAffine param() const {
        return {imode, border_mode, border_val, format};
    }
};

class WarpPerspective : public OpDefImplBase<WarpPerspective> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using InterpolationMode = ::megdnn::param::WarpPerspective::InterpolationMode;
    using BorderMode = ::megdnn::param::WarpPerspective::BorderMode;
    using Format = ::megdnn::param::WarpPerspective::Format;
    InterpolationMode imode = ::megdnn::param::WarpPerspective::InterpolationMode::LINEAR;
    BorderMode bmode = ::megdnn::param::WarpPerspective::BorderMode::REPLICATE;
    Format format = ::megdnn::param::WarpPerspective::Format::NCHW;
    float border_val = .0f;
    WarpPerspective() = default;
    WarpPerspective(InterpolationMode imode_, BorderMode bmode_, Format format_, float border_val_, std::string scope_ = {}): imode(imode_), bmode(bmode_), format(format_), border_val(border_val_) { set_scope(scope_); }
    WarpPerspective(::megdnn::param::WarpPerspective packed_param_0): imode(packed_param_0.imode), bmode(packed_param_0.bmode), format(packed_param_0.format), border_val(packed_param_0.border_val) {}
    ::megdnn::param::WarpPerspective param() const {
        return {imode, bmode, format, border_val};
    }
};

2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080
class WarpPerspectiveBackwardData : public OpDefImplBase<WarpPerspectiveBackwardData> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using InterpolationMode = ::megdnn::param::WarpPerspective::InterpolationMode;
    using BorderMode = ::megdnn::param::WarpPerspective::BorderMode;
    using Format = ::megdnn::param::WarpPerspective::Format;
    InterpolationMode imode = ::megdnn::param::WarpPerspective::InterpolationMode::LINEAR;
    BorderMode bmode = ::megdnn::param::WarpPerspective::BorderMode::REPLICATE;
    Format format = ::megdnn::param::WarpPerspective::Format::NCHW;
    float border_val = .0f;
    WarpPerspectiveBackwardData() = default;
    WarpPerspectiveBackwardData(InterpolationMode imode_, BorderMode bmode_, Format format_, float border_val_, std::string scope_ = {}): imode(imode_), bmode(bmode_), format(format_), border_val(border_val_) { set_scope(scope_); }
    WarpPerspectiveBackwardData(::megdnn::param::WarpPerspective packed_param_0): imode(packed_param_0.imode), bmode(packed_param_0.bmode), format(packed_param_0.format), border_val(packed_param_0.border_val) {}
    ::megdnn::param::WarpPerspective param() const {
        return {imode, bmode, format, border_val};
    }
};

class WarpPerspectiveBackwardMat : public OpDefImplBase<WarpPerspectiveBackwardMat> {
    MGB_DYN_TYPE_OBJ_FINAL_DECL;

public:
    using InterpolationMode = ::megdnn::param::WarpPerspective::InterpolationMode;
    using BorderMode = ::megdnn::param::WarpPerspective::BorderMode;
    using Format = ::megdnn::param::WarpPerspective::Format;
    InterpolationMode imode = ::megdnn::param::WarpPerspective::InterpolationMode::LINEAR;
    BorderMode bmode = ::megdnn::param::WarpPerspective::BorderMode::REPLICATE;
    Format format = ::megdnn::param::WarpPerspective::Format::NCHW;
    float border_val = .0f;
    WarpPerspectiveBackwardMat() = default;
    WarpPerspectiveBackwardMat(InterpolationMode imode_, BorderMode bmode_, Format format_, float border_val_, std::string scope_ = {}): imode(imode_), bmode(bmode_), format(format_), border_val(border_val_) { set_scope(scope_); }
    WarpPerspectiveBackwardMat(::megdnn::param::WarpPerspective packed_param_0): imode(packed_param_0.imode), bmode(packed_param_0.bmode), format(packed_param_0.format), border_val(packed_param_0.border_val) {}
    ::megdnn::param::WarpPerspective param() const {
        return {imode, bmode, format, border_val};
    }
};

2081
// clang-format on