comp_op_cost.py 39.9 KB
Newer Older
C
caozhou 已提交
1
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
2 3 4 5 6 7 8 9 10 11 12 13 14
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License

15
from .base_cost import CompOpCost, register_op_cost
C
caozhou 已提交
16 17


C
caozhou 已提交
18 19 20 21 22
@register_op_cost
class AdamOpCost(CompOpCost):
    OP_TYPE = "adam"

    def __init__(self, op=None, op_desc=None, cluster=None):
23 24 25
        super(AdamOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
26 27 28 29 30 31 32 33 34 35 36

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
@register_op_cost
class ArgsortOpCost(CompOpCost):
    OP_TYPE = "argsort"

    def __init__(self, op=None, op_desc=None, cluster=None):
        super(ArgsortOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


C
caozhou 已提交
56 57 58 59 60
@register_op_cost
class AssignOpCost(CompOpCost):
    OP_TYPE = "assign"

    def __init__(self, op=None, op_desc=None, cluster=None):
61 62 63
        super(AssignOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
64

C
caozhou 已提交
65
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
66 67 68 69 70 71 72 73 74 75 76 77 78 79
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class AssignValueOpCost(CompOpCost):
    OP_TYPE = "assign_value"

    def __init__(self, op=None, op_desc=None, cluster=None):
80 81 82
        super(AssignValueOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
83

C
caozhou 已提交
84
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
85 86 87 88 89 90 91 92 93 94 95 96 97 98
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class BeamSearchOpCost(CompOpCost):
    OP_TYPE = "beam_search"

    def __init__(self, op=None, op_desc=None, cluster=None):
99 100 101
        super(BeamSearchOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
102

C
caozhou 已提交
103
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
104 105 106 107 108 109 110 111 112 113 114 115 116 117
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class BeamSearchDecodeOpCost(CompOpCost):
    OP_TYPE = "beam_search_decode"

    def __init__(self, op=None, op_desc=None, cluster=None):
118 119 120
        super(BeamSearchDecodeOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
121

C
caozhou 已提交
122
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
123 124 125 126 127 128 129 130 131 132 133 134 135 136
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class CastOpCost(CompOpCost):
    OP_TYPE = "cast"

    def __init__(self, op=None, op_desc=None, cluster=None):
137 138 139
        super(CastOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
140

C
caozhou 已提交
141
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
142 143 144 145 146 147 148 149 150 151 152 153 154 155
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class ConcatOpCost(CompOpCost):
    OP_TYPE = "concat"

    def __init__(self, op=None, op_desc=None, cluster=None):
156 157 158
        super(ConcatOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
159

C
caozhou 已提交
160
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
161 162 163 164 165 166 167 168 169
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


170 171 172 173 174
@register_op_cost
class DropoutOpCost(CompOpCost):
    OP_TYPE = "dropout"

    def __init__(self, op=None, op_desc=None, cluster=None):
175 176 177
        super(DropoutOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
178 179 180 181 182 183 184 185 186 187 188

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


189 190 191 192 193
@register_op_cost
class DropoutGradOpCost(CompOpCost):
    OP_TYPE = "dropout_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
194 195 196
        super(DropoutGradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
197 198 199 200 201 202 203 204 205 206 207

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


C
caozhou 已提交
208 209 210 211 212
@register_op_cost
class ElementwiseAddOpCost(CompOpCost):
    OP_TYPE = "elementwise_add"

    def __init__(self, op=None, op_desc=None, cluster=None):
213 214 215
        super(ElementwiseAddOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
216

C
caozhou 已提交
217
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
218 219 220 221 222 223 224 225 226 227 228 229 230 231
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class ElementwiseAddGradOpCost(CompOpCost):
    OP_TYPE = "elementwise_add_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
232 233 234
        super(ElementwiseAddGradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
235

C
caozhou 已提交
236
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
237 238 239 240 241 242 243 244 245 246 247 248 249 250
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class ElementwiseDivOpCost(CompOpCost):
    OP_TYPE = "elementwise_div"

    def __init__(self, op=None, op_desc=None, cluster=None):
251 252 253
        super(ElementwiseDivOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
254

C
caozhou 已提交
255
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
256 257 258 259 260 261 262 263 264 265 266 267 268 269
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class ElementwiseDivGradOpCost(CompOpCost):
    OP_TYPE = "elementwise_div_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
270 271 272
        super(ElementwiseDivGradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
273

C
caozhou 已提交
274
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
275 276 277 278 279 280 281 282 283 284 285 286 287 288
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class ElementwiseMulOpCost(CompOpCost):
    OP_TYPE = "elementwise_mul"

    def __init__(self, op=None, op_desc=None, cluster=None):
289 290 291
        super(ElementwiseMulOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
292

C
caozhou 已提交
293
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
294 295 296 297 298 299 300 301 302 303 304 305 306 307
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class ElementwiseMulGradOpCost(CompOpCost):
    OP_TYPE = "elementwise_mul_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
308 309 310
        super(ElementwiseMulGradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
311

C
caozhou 已提交
312
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
313 314 315 316 317 318 319 320 321 322 323 324 325 326
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class ElementwiseSubOpCost(CompOpCost):
    OP_TYPE = "elementwise_sub"

    def __init__(self, op=None, op_desc=None, cluster=None):
327 328 329
        super(ElementwiseSubOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
330

C
caozhou 已提交
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class ElementwiseSubGradOpCost(CompOpCost):
    OP_TYPE = "elementwise_sub_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
346 347 348
        super(ElementwiseSubGradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
349 350

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
351 352
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class EqualOpCost(CompOpCost):
    OP_TYPE = "equal"

    def __init__(self, op=None, op_desc=None, cluster=None):
        super(EqualOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
C
caozhou 已提交
372 373 374 375 376 377 378 379 380 381 382 383
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class EmbeddingOpCost(CompOpCost):
    OP_TYPE = "c_embedding"

    def __init__(self, op=None, op_desc=None, cluster=None):
384 385 386
        super(EmbeddingOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
387

C
caozhou 已提交
388
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
389 390 391 392 393 394 395 396 397 398 399 400 401 402
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class EmbeddingGradOpCost(CompOpCost):
    OP_TYPE = "c_embedding_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
403 404 405
        super(EmbeddingGradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
406

C
caozhou 已提交
407
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
408 409 410 411 412 413 414 415 416 417 418 419 420 421
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class FillConstantOpCost(CompOpCost):
    OP_TYPE = "fill_constant"

    def __init__(self, op=None, op_desc=None, cluster=None):
422 423 424
        super(FillConstantOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
425

C
caozhou 已提交
426
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
427 428 429 430 431 432 433 434 435 436 437 438 439 440
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class FillConstantBatchSizeLikeOpCost(CompOpCost):
    OP_TYPE = "fill_constant_batch_size_like"

    def __init__(self, op=None, op_desc=None, cluster=None):
441 442 443
        super(FillConstantBatchSizeLikeOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
444

C
caozhou 已提交
445
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
446 447 448 449 450 451 452 453 454
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


455 456 457 458 459
@register_op_cost
class FusedSoftmaxMaskUpperTriangleOpCost(CompOpCost):
    OP_TYPE = "fused_softmax_mask_upper_triangle"

    def __init__(self, op=None, op_desc=None, cluster=None):
460 461 462
        super(FusedSoftmaxMaskUpperTriangleOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class FusedSoftmaxMaskUpperTriangleGradOpCost(CompOpCost):
    OP_TYPE = "fused_softmax_mask_upper_triangle_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
479 480 481
        super(FusedSoftmaxMaskUpperTriangleGradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
482 483 484 485 486 487 488 489 490 491 492

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


C
caozhou 已提交
493 494 495 496 497
@register_op_cost
class GatherOpCost(CompOpCost):
    OP_TYPE = "gather"

    def __init__(self, op=None, op_desc=None, cluster=None):
498 499 500
        super(GatherOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
501

C
caozhou 已提交
502
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
503 504 505 506 507 508 509 510 511 512 513 514 515 516
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class GeluOpCost(CompOpCost):
    OP_TYPE = "gelu"

    def __init__(self, op=None, op_desc=None, cluster=None):
517 518 519
        super(GeluOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
520

C
caozhou 已提交
521
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
522 523 524 525 526 527 528 529 530 531 532 533 534 535
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class GeluGradOpCost(CompOpCost):
    OP_TYPE = "gelu_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
536 537 538
        super(GeluGradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
539

C
caozhou 已提交
540
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
541 542 543 544 545 546 547 548 549 550 551 552 553 554
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class GreaterEqualOpCost(CompOpCost):
    OP_TYPE = "greater_equal"

    def __init__(self, op=None, op_desc=None, cluster=None):
555 556 557
        super(GreaterEqualOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
558

C
caozhou 已提交
559
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
560 561 562 563 564 565 566 567 568 569 570 571 572 573
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class IncrementOpCost(CompOpCost):
    OP_TYPE = "increment"

    def __init__(self, op=None, op_desc=None, cluster=None):
574 575 576
        super(IncrementOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
577

C
caozhou 已提交
578
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
579 580 581 582 583 584 585 586 587 588
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class IsEmptyOpCost(CompOpCost):
    OP_TYPE = "is_empty"

    def __init__(self, op=None, op_desc=None, cluster=None):
589 590 591
        super(IsEmptyOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
592

C
caozhou 已提交
593
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
594 595 596 597 598 599 600 601 602 603
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class LayerNormOpCost(CompOpCost):
    OP_TYPE = "layer_norm"

    def __init__(self, op=None, op_desc=None, cluster=None):
604 605 606
        super(LayerNormOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
607

C
caozhou 已提交
608
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
609 610 611 612 613 614 615 616 617 618 619 620 621 622
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class LayerNormGradOpCost(CompOpCost):
    OP_TYPE = "layer_norm_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
623 624 625
        super(LayerNormGradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
626

C
caozhou 已提交
627
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
628 629 630 631 632 633 634 635 636 637 638 639 640 641
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class LessThanOpCost(CompOpCost):
    OP_TYPE = "less_than"

    def __init__(self, op=None, op_desc=None, cluster=None):
642 643 644
        super(LessThanOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
645

C
caozhou 已提交
646
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
647 648 649 650 651 652 653 654 655 656 657 658 659 660
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class LogicalNotOpCost(CompOpCost):
    OP_TYPE = "logical_not"

    def __init__(self, op=None, op_desc=None, cluster=None):
661 662 663
        super(LogicalNotOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
664

C
caozhou 已提交
665
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
666 667 668 669 670 671 672 673 674 675 676 677 678 679
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class LogicalAndOpCost(CompOpCost):
    OP_TYPE = "logical_and"

    def __init__(self, op=None, op_desc=None, cluster=None):
680 681 682
        super(LogicalAndOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
683

C
caozhou 已提交
684
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
685 686 687 688 689 690 691 692 693 694 695 696 697 698
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class LodResetOpCost(CompOpCost):
    OP_TYPE = "lod_reset"

    def __init__(self, op=None, op_desc=None, cluster=None):
699 700 701
        super(LodResetOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
702

C
caozhou 已提交
703
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class LogOpCost(CompOpCost):
    OP_TYPE = "log"

    def __init__(self, op=None, op_desc=None, cluster=None):
        super(LogOpCost, self).__init__(op=op, op_desc=op_desc, cluster=cluster)

C
caozhou 已提交
720
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
721 722 723 724 725 726 727 728 729 730 731 732 733 734
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class LookupTableV2OpCost(CompOpCost):
    OP_TYPE = "lookup_table_v2"

    def __init__(self, op=None, op_desc=None, cluster=None):
735 736 737
        super(LookupTableV2OpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
738

C
caozhou 已提交
739
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
740 741 742 743 744 745 746 747 748 749 750 751 752 753
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class LookupTableV2GradOpCost(CompOpCost):
    OP_TYPE = "lookup_table_v2_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
754 755 756
        super(LookupTableV2GradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
757

C
caozhou 已提交
758
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
759 760 761 762 763 764 765 766 767 768 769 770 771 772
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class MatmulOpCost(CompOpCost):
    OP_TYPE = "matmul"

    def __init__(self, op=None, op_desc=None, cluster=None):
773 774 775
        super(MatmulOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
776

C
caozhou 已提交
777
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
778 779 780 781 782 783 784 785 786 787 788 789 790 791
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class MatmulGradOpCost(CompOpCost):
    OP_TYPE = "matmul_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
792 793 794
        super(MatmulGradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
795

C
caozhou 已提交
796
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
C
caozhou 已提交
797 798 799 800 801 802 803
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0
804 805 806 807 808 809 810


@register_op_cost
class MatmulV2OpCost(CompOpCost):
    OP_TYPE = "matmul_v2"

    def __init__(self, op=None, op_desc=None, cluster=None):
811 812 813
        super(MatmulV2OpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
814

C
caozhou 已提交
815 816 817 818 819 820 821 822 823 824 825 826 827 828 829
    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class MatmulV2GradOpCost(CompOpCost):
    OP_TYPE = "matmul_v2_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
830 831 832
        super(MatmulV2GradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class MemcpyOpCost(CompOpCost):
    OP_TYPE = "memcpy"

    def __init__(self, op=None, op_desc=None, cluster=None):
849 850 851
        super(MemcpyOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
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

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class MulOpCost(CompOpCost):
    OP_TYPE = "mul"

    def __init__(self, op=None, op_desc=None, cluster=None):
        super(MulOpCost, self).__init__(op=op, op_desc=op_desc, cluster=cluster)

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class MulGradOpCost(CompOpCost):
    OP_TYPE = "mul_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
885 886 887
        super(MulGradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class OneHotOpCost(CompOpCost):
    OP_TYPE = "one_hot"

    def __init__(self, op=None, op_desc=None, cluster=None):
904 905 906
        super(OneHotOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class ReadFromArrayOpCost(CompOpCost):
    OP_TYPE = "read_from_array"

    def __init__(self, op=None, op_desc=None, cluster=None):
923 924 925
        super(ReadFromArrayOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class ReduceSumOpCost(CompOpCost):
    OP_TYPE = "reduce_sum"

    def __init__(self, op=None, op_desc=None, cluster=None):
942 943 944
        super(ReduceSumOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class ReduceSumGradOpCost(CompOpCost):
    OP_TYPE = "reduce_sum_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
961 962 963
        super(ReduceSumGradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class Reshape2OpCost(CompOpCost):
    OP_TYPE = "reshape2"

    def __init__(self, op=None, op_desc=None, cluster=None):
980 981 982
        super(Reshape2OpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class Reshape2GradOpCost(CompOpCost):
    OP_TYPE = "reshape2_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
999 1000 1001
        super(Reshape2GradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class ReduceMeanOpCost(CompOpCost):
    OP_TYPE = "reduce_mean"

    def __init__(self, op=None, op_desc=None, cluster=None):
1018 1019 1020
        super(ReduceMeanOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class ReduceMeanGradOpCost(CompOpCost):
    OP_TYPE = "reduce_mean_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
1037 1038 1039
        super(ReduceMeanGradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class SamplingIdOpCost(CompOpCost):
    OP_TYPE = "sampling_id"

    def __init__(self, op=None, op_desc=None, cluster=None):
1056 1057 1058
        super(SamplingIdOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class ScaleOpCost(CompOpCost):
    OP_TYPE = "scale"

    def __init__(self, op=None, op_desc=None, cluster=None):
1075 1076 1077
        super(ScaleOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class SliceOpCost(CompOpCost):
    OP_TYPE = "slice"

    def __init__(self, op=None, op_desc=None, cluster=None):
1094 1095 1096
        super(SliceOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class SoftmaxOpCost(CompOpCost):
    OP_TYPE = "softmax"

    def __init__(self, op=None, op_desc=None, cluster=None):
1113 1114 1115
        super(SoftmaxOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class SoftmaxGradOpCost(CompOpCost):
    OP_TYPE = "softmax_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
1132 1133 1134
        super(SoftmaxGradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class SoftmaxWithCrossEntropyOpCost(CompOpCost):
    OP_TYPE = "softmax_with_cross_entropy"

    def __init__(self, op=None, op_desc=None, cluster=None):
1151 1152 1153
        super(SoftmaxWithCrossEntropyOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class SoftmaxWithCrossEntropyGradOpCost(CompOpCost):
    OP_TYPE = "softmax_with_cross_entropy_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
1170 1171 1172
        super(SoftmaxWithCrossEntropyGradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class SplitOpCost(CompOpCost):
    OP_TYPE = "split"

    def __init__(self, op=None, op_desc=None, cluster=None):
1189 1190 1191
        super(SplitOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class Squeeze2OpCost(CompOpCost):
    OP_TYPE = "squeeze2"

    def __init__(self, op=None, op_desc=None, cluster=None):
1208 1209 1210
        super(Squeeze2OpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class SquareOpCost(CompOpCost):
    OP_TYPE = "square"

    def __init__(self, op=None, op_desc=None, cluster=None):
1227 1228 1229
        super(SquareOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class SquareGradOpCost(CompOpCost):
    OP_TYPE = "square_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
1246 1247 1248
        super(SquareGradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
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

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class SumOpCost(CompOpCost):
    OP_TYPE = "sum"

    def __init__(self, op=None, op_desc=None, cluster=None):
        super(SumOpCost, self).__init__(op=op, op_desc=op_desc, cluster=cluster)

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class TopKOpCost(CompOpCost):
    OP_TYPE = "top_k"

    def __init__(self, op=None, op_desc=None, cluster=None):
1282 1283 1284
        super(TopKOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class Transpose2OpCost(CompOpCost):
    OP_TYPE = "transpose2"

    def __init__(self, op=None, op_desc=None, cluster=None):
1301 1302 1303
        super(Transpose2OpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class Transpose2GradOpCost(CompOpCost):
    OP_TYPE = "transpose2_grad"

    def __init__(self, op=None, op_desc=None, cluster=None):
1320 1321 1322
        super(Transpose2GradOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class Unsqueeze2OpCost(CompOpCost):
    OP_TYPE = "unsqueeze2"

    def __init__(self, op=None, op_desc=None, cluster=None):
1339 1340 1341
        super(Unsqueeze2OpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0


@register_op_cost
class WriteToArrayOpCost(CompOpCost):
    OP_TYPE = "write_to_array"

    def __init__(self, op=None, op_desc=None, cluster=None):
1358 1359 1360
        super(WriteToArrayOpCost, self).__init__(
            op=op, op_desc=op_desc, cluster=cluster
        )
C
caozhou 已提交
1361 1362

    # For a concrete COMP OP, the calc_time and calc_flops function need to be overrided
1363 1364 1365 1366 1367 1368 1369
    def calc_flops(self):
        # NOTE: The actual formula will be filled in the future
        return 0

    def calc_time(self):
        # NOTE: The actual formula will be filled in the future
        return 0