1 // @lint-ignore-every CLANGTIDY HOWTOEVEN
2 // AUTO-GENERATED FROM: torchgen/static_runtime/gen_static_runtime_ops.py
3 #include <gtest/gtest.h>
4 #include <torch/csrc/jit/runtime/static/impl.h>
5 #include <torch/torch.h>
6
7 #include "test_utils.h"
8
9 using namespace caffe2;
10 using namespace torch;
11 using namespace torch::jit;
12 using namespace torch::jit::test;
13 using c10::IValue;
14
TEST(StaticRuntime,autogen_absolute)15 TEST(StaticRuntime, autogen_absolute) {
16 const std::string script = R"IR(
17 graph(%self: Tensor):
18 %bias: None = prim::Constant()
19 %ret = aten::absolute(%self)
20 %cloned = aten::clone(%ret, %bias)
21 return (%cloned)
22 )IR";
23
24 auto self0 = at::rand({6, 6, 6});
25 std::vector<IValue> args{self0};
26 testStaticRuntime(
27 script,
28 args,
29 {},
30 /*use_allclose=*/false,
31 /*use_equalnan=*/false,
32 /*check_resize=*/true);
33
34 auto self1 = at::rand({22, 22, 22});
35 std::vector<IValue> args2{self1};
36 testStaticRuntime(
37 script,
38 args,
39 args2,
40 /*use_allclose=*/false,
41 /*use_equalnan=*/false,
42 /*check_resize=*/true);
43 }
44
TEST(StaticRuntime,autogen_angle)45 TEST(StaticRuntime, autogen_angle) {
46 const std::string script = R"IR(
47 graph(%self: Tensor):
48 %bias: None = prim::Constant()
49 %ret = aten::angle(%self)
50 %cloned = aten::clone(%ret, %bias)
51 return (%cloned)
52 )IR";
53
54 auto self0 = at::rand({6, 6, 6});
55 std::vector<IValue> args{self0};
56 testStaticRuntime(
57 script,
58 args,
59 {},
60 /*use_allclose=*/false,
61 /*use_equalnan=*/false,
62 /*check_resize=*/true);
63
64 auto self1 = at::rand({22, 22, 22});
65 std::vector<IValue> args2{self1};
66 testStaticRuntime(
67 script,
68 args,
69 args2,
70 /*use_allclose=*/false,
71 /*use_equalnan=*/false,
72 /*check_resize=*/true);
73 }
74
TEST(StaticRuntime,autogen_sgn)75 TEST(StaticRuntime, autogen_sgn) {
76 const std::string script = R"IR(
77 graph(%self: Tensor):
78 %bias: None = prim::Constant()
79 %ret = aten::sgn(%self)
80 %cloned = aten::clone(%ret, %bias)
81 return (%cloned)
82 )IR";
83
84 auto self0 = at::rand({6, 6, 6});
85 std::vector<IValue> args{self0};
86 testStaticRuntime(
87 script,
88 args,
89 {},
90 /*use_allclose=*/false,
91 /*use_equalnan=*/false,
92 /*check_resize=*/true);
93
94 auto self1 = at::rand({22, 22, 22});
95 std::vector<IValue> args2{self1};
96 testStaticRuntime(
97 script,
98 args,
99 args2,
100 /*use_allclose=*/false,
101 /*use_equalnan=*/false,
102 /*check_resize=*/true);
103 }
104
TEST(StaticRuntime,autogen_acos)105 TEST(StaticRuntime, autogen_acos) {
106 const std::string script = R"IR(
107 graph(%self: Tensor):
108 %bias: None = prim::Constant()
109 %ret = aten::acos(%self)
110 %cloned = aten::clone(%ret, %bias)
111 return (%cloned)
112 )IR";
113
114 auto self0 = at::rand({6, 6, 6});
115 std::vector<IValue> args{self0};
116 testStaticRuntime(
117 script,
118 args,
119 {},
120 /*use_allclose=*/false,
121 /*use_equalnan=*/false,
122 /*check_resize=*/true);
123
124 auto self1 = at::rand({22, 22, 22});
125 std::vector<IValue> args2{self1};
126 testStaticRuntime(
127 script,
128 args,
129 args2,
130 /*use_allclose=*/false,
131 /*use_equalnan=*/false,
132 /*check_resize=*/true);
133 }
134
TEST(StaticRuntime,autogen_arccos)135 TEST(StaticRuntime, autogen_arccos) {
136 const std::string script = R"IR(
137 graph(%self: Tensor):
138 %bias: None = prim::Constant()
139 %ret = aten::arccos(%self)
140 %cloned = aten::clone(%ret, %bias)
141 return (%cloned)
142 )IR";
143
144 auto self0 = at::rand({6, 6, 6});
145 std::vector<IValue> args{self0};
146 testStaticRuntime(
147 script,
148 args,
149 {},
150 /*use_allclose=*/false,
151 /*use_equalnan=*/false,
152 /*check_resize=*/true);
153
154 auto self1 = at::rand({22, 22, 22});
155 std::vector<IValue> args2{self1};
156 testStaticRuntime(
157 script,
158 args,
159 args2,
160 /*use_allclose=*/false,
161 /*use_equalnan=*/false,
162 /*check_resize=*/true);
163 }
164
TEST(StaticRuntime,autogen__add_relu_Tensor)165 TEST(StaticRuntime, autogen__add_relu_Tensor) {
166 const std::string script = R"IR(
167 graph(%self: Tensor, %other: Tensor, %alpha: int):
168 %bias: None = prim::Constant()
169 %ret = aten::_add_relu(%self, %other, %alpha)
170 %cloned = aten::clone(%ret, %bias)
171 return (%cloned)
172 )IR";
173
174 auto self0 = at::rand({6, 6, 6});
175 auto other0 = at::rand({6, 6, 6});
176 auto alpha0 = 2;
177 std::vector<IValue> args{self0, other0, alpha0};
178 testStaticRuntime(
179 script,
180 args,
181 {},
182 /*use_allclose=*/false,
183 /*use_equalnan=*/false,
184 /*check_resize=*/true);
185
186 auto self1 = at::rand({22, 22, 22});
187 auto other1 = at::rand({22, 22, 22});
188 auto alpha1 = 2;
189 std::vector<IValue> args2{self1, other1, alpha1};
190 testStaticRuntime(
191 script,
192 args,
193 args2,
194 /*use_allclose=*/false,
195 /*use_equalnan=*/false,
196 /*check_resize=*/true);
197 }
198
TEST(StaticRuntime,autogen_addmv)199 TEST(StaticRuntime, autogen_addmv) {
200 const std::string script = R"IR(
201 graph(%self: Tensor, %mat: Tensor, %vec: Tensor, %beta: int, %alpha: int):
202 %bias: None = prim::Constant()
203 %ret = aten::addmv(%self, %mat, %vec, %beta, %alpha)
204 %cloned = aten::clone(%ret, %bias)
205 return (%cloned)
206 )IR";
207
208 auto self0 = at::rand({2});
209 auto mat0 = at::rand({2, 2});
210 auto vec0 = at::rand({2});
211 auto beta0 = 2;
212 auto alpha0 = 2;
213 std::vector<IValue> args{self0, mat0, vec0, beta0, alpha0};
214 testStaticRuntime(
215 script,
216 args,
217 {},
218 /*use_allclose=*/false,
219 /*use_equalnan=*/false,
220 /*check_resize=*/true);
221
222 auto self1 = at::rand({35});
223 auto mat1 = at::rand({35, 35});
224 auto vec1 = at::rand({35});
225 auto beta1 = 2;
226 auto alpha1 = 2;
227 std::vector<IValue> args2{self1, mat1, vec1, beta1, alpha1};
228 testStaticRuntime(
229 script,
230 args,
231 args2,
232 /*use_allclose=*/false,
233 /*use_equalnan=*/false,
234 /*check_resize=*/true);
235 }
236
TEST(StaticRuntime,autogen_addr)237 TEST(StaticRuntime, autogen_addr) {
238 const std::string script = R"IR(
239 graph(%self: Tensor, %vec1: Tensor, %vec2: Tensor, %beta: int, %alpha: int):
240 %bias: None = prim::Constant()
241 %ret = aten::addr(%self, %vec1, %vec2, %beta, %alpha)
242 %cloned = aten::clone(%ret, %bias)
243 return (%cloned)
244 )IR";
245
246 auto self0 = at::rand({6, 6});
247 auto vec10 = at::rand({6});
248 auto vec20 = at::rand({6});
249 auto beta0 = 2;
250 auto alpha0 = 2;
251 std::vector<IValue> args{self0, vec10, vec20, beta0, alpha0};
252 testStaticRuntime(
253 script,
254 args,
255 {},
256 /*use_allclose=*/false,
257 /*use_equalnan=*/false,
258 /*check_resize=*/true);
259
260 auto self1 = at::rand({22, 22});
261 auto vec11 = at::rand({22});
262 auto vec21 = at::rand({22});
263 auto beta1 = 2;
264 auto alpha1 = 2;
265 std::vector<IValue> args2{self1, vec11, vec21, beta1, alpha1};
266 testStaticRuntime(
267 script,
268 args,
269 args2,
270 /*use_allclose=*/false,
271 /*use_equalnan=*/false,
272 /*check_resize=*/true);
273 }
274
TEST(StaticRuntime,autogen__test_functorch_fallback)275 TEST(StaticRuntime, autogen__test_functorch_fallback) {
276 const std::string script = R"IR(
277 graph(%self: Tensor, %other: Tensor):
278 %bias: None = prim::Constant()
279 %ret = aten::_test_functorch_fallback(%self, %other)
280 %cloned = aten::clone(%ret, %bias)
281 return (%cloned)
282 )IR";
283
284 auto self0 = at::rand({6, 6, 6});
285 auto other0 = at::rand({6, 6, 6});
286 std::vector<IValue> args{self0, other0};
287 testStaticRuntime(
288 script,
289 args,
290 {},
291 /*use_allclose=*/false,
292 /*use_equalnan=*/false,
293 /*check_resize=*/true);
294
295 auto self1 = at::rand({22, 22, 22});
296 auto other1 = at::rand({22, 22, 22});
297 std::vector<IValue> args2{self1, other1};
298 testStaticRuntime(
299 script,
300 args,
301 args2,
302 /*use_allclose=*/false,
303 /*use_equalnan=*/false,
304 /*check_resize=*/true);
305 }
306
TEST(StaticRuntime,autogen_argmax)307 TEST(StaticRuntime, autogen_argmax) {
308 const std::string script = R"IR(
309 graph(%self: Tensor, %dim: int?, %keepdim: bool):
310 %bias: None = prim::Constant()
311 %ret = aten::argmax(%self, %dim, %keepdim)
312 %cloned = aten::clone(%ret, %bias)
313 return (%cloned)
314 )IR";
315
316 auto self0 = at::rand({6, 6, 6});
317 auto dim0 = 1;
318 auto keepdim0 = false;
319 std::vector<IValue> args{self0, dim0, keepdim0};
320 testStaticRuntime(
321 script,
322 args,
323 {},
324 /*use_allclose=*/false,
325 /*use_equalnan=*/false,
326 /*check_resize=*/true);
327
328 auto self1 = at::rand({22, 22, 22});
329 auto dim1 = 1;
330 auto keepdim1 = false;
331 std::vector<IValue> args2{self1, dim1, keepdim1};
332 testStaticRuntime(
333 script,
334 args,
335 args2,
336 /*use_allclose=*/false,
337 /*use_equalnan=*/false,
338 /*check_resize=*/true);
339 }
340
TEST(StaticRuntime,autogen_acosh)341 TEST(StaticRuntime, autogen_acosh) {
342 const std::string script = R"IR(
343 graph(%self: Tensor):
344 %bias: None = prim::Constant()
345 %ret = aten::acosh(%self)
346 %cloned = aten::clone(%ret, %bias)
347 return (%cloned)
348 )IR";
349
350 auto self0 = at::rand({2, 2, 2}) + at::ones({2, 2, 2});
351 std::vector<IValue> args{self0};
352 testStaticRuntime(
353 script,
354 args,
355 {},
356 /*use_allclose=*/false,
357 /*use_equalnan=*/false,
358 /*check_resize=*/true);
359
360 auto self1 = at::rand({5, 5, 5}) + at::ones({5, 5, 5});
361 std::vector<IValue> args2{self1};
362 testStaticRuntime(
363 script,
364 args,
365 args2,
366 /*use_allclose=*/false,
367 /*use_equalnan=*/false,
368 /*check_resize=*/true);
369 }
370
TEST(StaticRuntime,autogen_asinh)371 TEST(StaticRuntime, autogen_asinh) {
372 const std::string script = R"IR(
373 graph(%self: Tensor):
374 %bias: None = prim::Constant()
375 %ret = aten::asinh(%self)
376 %cloned = aten::clone(%ret, %bias)
377 return (%cloned)
378 )IR";
379
380 auto self0 = at::rand({6, 6, 6});
381 std::vector<IValue> args{self0};
382 testStaticRuntime(
383 script,
384 args,
385 {},
386 /*use_allclose=*/false,
387 /*use_equalnan=*/false,
388 /*check_resize=*/true);
389
390 auto self1 = at::rand({22, 22, 22});
391 std::vector<IValue> args2{self1};
392 testStaticRuntime(
393 script,
394 args,
395 args2,
396 /*use_allclose=*/false,
397 /*use_equalnan=*/false,
398 /*check_resize=*/true);
399 }
400
TEST(StaticRuntime,autogen_arcsinh)401 TEST(StaticRuntime, autogen_arcsinh) {
402 const std::string script = R"IR(
403 graph(%self: Tensor):
404 %bias: None = prim::Constant()
405 %ret = aten::arcsinh(%self)
406 %cloned = aten::clone(%ret, %bias)
407 return (%cloned)
408 )IR";
409
410 auto self0 = at::rand({6, 6, 6});
411 std::vector<IValue> args{self0};
412 testStaticRuntime(
413 script,
414 args,
415 {},
416 /*use_allclose=*/false,
417 /*use_equalnan=*/false,
418 /*check_resize=*/true);
419
420 auto self1 = at::rand({22, 22, 22});
421 std::vector<IValue> args2{self1};
422 testStaticRuntime(
423 script,
424 args,
425 args2,
426 /*use_allclose=*/false,
427 /*use_equalnan=*/false,
428 /*check_resize=*/true);
429 }
430
TEST(StaticRuntime,autogen_atanh)431 TEST(StaticRuntime, autogen_atanh) {
432 const std::string script = R"IR(
433 graph(%self: Tensor):
434 %bias: None = prim::Constant()
435 %ret = aten::atanh(%self)
436 %cloned = aten::clone(%ret, %bias)
437 return (%cloned)
438 )IR";
439
440 auto self0 = at::rand({6, 6, 6});
441 std::vector<IValue> args{self0};
442 testStaticRuntime(
443 script,
444 args,
445 {},
446 /*use_allclose=*/false,
447 /*use_equalnan=*/false,
448 /*check_resize=*/true);
449
450 auto self1 = at::rand({22, 22, 22});
451 std::vector<IValue> args2{self1};
452 testStaticRuntime(
453 script,
454 args,
455 args2,
456 /*use_allclose=*/false,
457 /*use_equalnan=*/false,
458 /*check_resize=*/true);
459 }
460
TEST(StaticRuntime,autogen_arctanh)461 TEST(StaticRuntime, autogen_arctanh) {
462 const std::string script = R"IR(
463 graph(%self: Tensor):
464 %bias: None = prim::Constant()
465 %ret = aten::arctanh(%self)
466 %cloned = aten::clone(%ret, %bias)
467 return (%cloned)
468 )IR";
469
470 auto self0 = at::rand({6, 6, 6});
471 std::vector<IValue> args{self0};
472 testStaticRuntime(
473 script,
474 args,
475 {},
476 /*use_allclose=*/false,
477 /*use_equalnan=*/false,
478 /*check_resize=*/true);
479
480 auto self1 = at::rand({22, 22, 22});
481 std::vector<IValue> args2{self1};
482 testStaticRuntime(
483 script,
484 args,
485 args2,
486 /*use_allclose=*/false,
487 /*use_equalnan=*/false,
488 /*check_resize=*/true);
489 }
490
TEST(StaticRuntime,autogen_asin)491 TEST(StaticRuntime, autogen_asin) {
492 const std::string script = R"IR(
493 graph(%self: Tensor):
494 %bias: None = prim::Constant()
495 %ret = aten::asin(%self)
496 %cloned = aten::clone(%ret, %bias)
497 return (%cloned)
498 )IR";
499
500 auto self0 = at::rand({6, 6, 6});
501 std::vector<IValue> args{self0};
502 testStaticRuntime(
503 script,
504 args,
505 {},
506 /*use_allclose=*/false,
507 /*use_equalnan=*/false,
508 /*check_resize=*/true);
509
510 auto self1 = at::rand({22, 22, 22});
511 std::vector<IValue> args2{self1};
512 testStaticRuntime(
513 script,
514 args,
515 args2,
516 /*use_allclose=*/false,
517 /*use_equalnan=*/false,
518 /*check_resize=*/true);
519 }
520
TEST(StaticRuntime,autogen_arcsin)521 TEST(StaticRuntime, autogen_arcsin) {
522 const std::string script = R"IR(
523 graph(%self: Tensor):
524 %bias: None = prim::Constant()
525 %ret = aten::arcsin(%self)
526 %cloned = aten::clone(%ret, %bias)
527 return (%cloned)
528 )IR";
529
530 auto self0 = at::rand({6, 6, 6});
531 std::vector<IValue> args{self0};
532 testStaticRuntime(
533 script,
534 args,
535 {},
536 /*use_allclose=*/false,
537 /*use_equalnan=*/false,
538 /*check_resize=*/true);
539
540 auto self1 = at::rand({22, 22, 22});
541 std::vector<IValue> args2{self1};
542 testStaticRuntime(
543 script,
544 args,
545 args2,
546 /*use_allclose=*/false,
547 /*use_equalnan=*/false,
548 /*check_resize=*/true);
549 }
550
TEST(StaticRuntime,autogen_atan)551 TEST(StaticRuntime, autogen_atan) {
552 const std::string script = R"IR(
553 graph(%self: Tensor):
554 %bias: None = prim::Constant()
555 %ret = aten::atan(%self)
556 %cloned = aten::clone(%ret, %bias)
557 return (%cloned)
558 )IR";
559
560 auto self0 = at::rand({6, 6, 6});
561 std::vector<IValue> args{self0};
562 testStaticRuntime(
563 script,
564 args,
565 {},
566 /*use_allclose=*/false,
567 /*use_equalnan=*/false,
568 /*check_resize=*/true);
569
570 auto self1 = at::rand({22, 22, 22});
571 std::vector<IValue> args2{self1};
572 testStaticRuntime(
573 script,
574 args,
575 args2,
576 /*use_allclose=*/false,
577 /*use_equalnan=*/false,
578 /*check_resize=*/true);
579 }
580
TEST(StaticRuntime,autogen_arctan)581 TEST(StaticRuntime, autogen_arctan) {
582 const std::string script = R"IR(
583 graph(%self: Tensor):
584 %bias: None = prim::Constant()
585 %ret = aten::arctan(%self)
586 %cloned = aten::clone(%ret, %bias)
587 return (%cloned)
588 )IR";
589
590 auto self0 = at::rand({6, 6, 6});
591 std::vector<IValue> args{self0};
592 testStaticRuntime(
593 script,
594 args,
595 {},
596 /*use_allclose=*/false,
597 /*use_equalnan=*/false,
598 /*check_resize=*/true);
599
600 auto self1 = at::rand({22, 22, 22});
601 std::vector<IValue> args2{self1};
602 testStaticRuntime(
603 script,
604 args,
605 args2,
606 /*use_allclose=*/false,
607 /*use_equalnan=*/false,
608 /*check_resize=*/true);
609 }
610
TEST(StaticRuntime,autogen_baddbmm)611 TEST(StaticRuntime, autogen_baddbmm) {
612 const std::string script = R"IR(
613 graph(%self: Tensor, %batch1: Tensor, %batch2: Tensor, %beta: int, %alpha: int):
614 %bias: None = prim::Constant()
615 %ret = aten::baddbmm(%self, %batch1, %batch2, %beta, %alpha)
616 %cloned = aten::clone(%ret, %bias)
617 return (%cloned)
618 )IR";
619
620 auto self0 = at::rand({6, 6, 6});
621 auto batch10 = at::rand({6, 6, 6});
622 auto batch20 = at::rand({6, 6, 6});
623 auto beta0 = 2;
624 auto alpha0 = 2;
625 std::vector<IValue> args{self0, batch10, batch20, beta0, alpha0};
626 testStaticRuntime(
627 script,
628 args,
629 {},
630 /*use_allclose=*/false,
631 /*use_equalnan=*/false,
632 /*check_resize=*/true);
633
634 auto self1 = at::rand({22, 22, 22});
635 auto batch11 = at::rand({22, 22, 22});
636 auto batch21 = at::rand({22, 22, 22});
637 auto beta1 = 2;
638 auto alpha1 = 2;
639 std::vector<IValue> args2{self1, batch11, batch21, beta1, alpha1};
640 testStaticRuntime(
641 script,
642 args,
643 args2,
644 /*use_allclose=*/false,
645 /*use_equalnan=*/false,
646 /*check_resize=*/true);
647 }
648
TEST(StaticRuntime,autogen_bitwise_not)649 TEST(StaticRuntime, autogen_bitwise_not) {
650 const std::string script = R"IR(
651 graph(%self: Tensor):
652 %bias: None = prim::Constant()
653 %ret = aten::bitwise_not(%self)
654 %cloned = aten::clone(%ret, %bias)
655 return (%cloned)
656 )IR";
657
658 auto self0 = at::randint(1, 100, {6, 6, 6}, at::kInt);
659 std::vector<IValue> args{self0};
660 testStaticRuntime(
661 script,
662 args,
663 {},
664 /*use_allclose=*/false,
665 /*use_equalnan=*/false,
666 /*check_resize=*/true);
667
668 auto self1 = at::randint(1, 100, {22, 22, 22}, at::kInt);
669 std::vector<IValue> args2{self1};
670 testStaticRuntime(
671 script,
672 args,
673 args2,
674 /*use_allclose=*/false,
675 /*use_equalnan=*/false,
676 /*check_resize=*/true);
677 }
678
TEST(StaticRuntime,autogen_copysign_Tensor)679 TEST(StaticRuntime, autogen_copysign_Tensor) {
680 const std::string script = R"IR(
681 graph(%self: Tensor, %other: Tensor):
682 %bias: None = prim::Constant()
683 %ret = aten::copysign(%self, %other)
684 %cloned = aten::clone(%ret, %bias)
685 return (%cloned)
686 )IR";
687
688 auto self0 = at::rand({6, 6, 6});
689 auto other0 = at::rand({6, 6, 6});
690 std::vector<IValue> args{self0, other0};
691 testStaticRuntime(
692 script,
693 args,
694 {},
695 /*use_allclose=*/false,
696 /*use_equalnan=*/false,
697 /*check_resize=*/true);
698
699 auto self1 = at::rand({22, 22, 22});
700 auto other1 = at::rand({22, 22, 22});
701 std::vector<IValue> args2{self1, other1};
702 testStaticRuntime(
703 script,
704 args,
705 args2,
706 /*use_allclose=*/false,
707 /*use_equalnan=*/false,
708 /*check_resize=*/true);
709 }
710
TEST(StaticRuntime,autogen_logical_not)711 TEST(StaticRuntime, autogen_logical_not) {
712 const std::string script = R"IR(
713 graph(%self: Tensor):
714 %bias: None = prim::Constant()
715 %ret = aten::logical_not(%self)
716 %cloned = aten::clone(%ret, %bias)
717 return (%cloned)
718 )IR";
719
720 auto self0 = at::rand({6, 6, 6});
721 std::vector<IValue> args{self0};
722 testStaticRuntime(
723 script,
724 args,
725 {},
726 /*use_allclose=*/false,
727 /*use_equalnan=*/false,
728 /*check_resize=*/true);
729
730 auto self1 = at::rand({22, 22, 22});
731 std::vector<IValue> args2{self1};
732 testStaticRuntime(
733 script,
734 args,
735 args2,
736 /*use_allclose=*/false,
737 /*use_equalnan=*/false,
738 /*check_resize=*/true);
739 }
740
TEST(StaticRuntime,autogen_logical_xor)741 TEST(StaticRuntime, autogen_logical_xor) {
742 const std::string script = R"IR(
743 graph(%self: Tensor, %other: Tensor):
744 %bias: None = prim::Constant()
745 %ret = aten::logical_xor(%self, %other)
746 %cloned = aten::clone(%ret, %bias)
747 return (%cloned)
748 )IR";
749
750 auto self0 = at::rand({6, 6, 6});
751 auto other0 = at::rand({6, 6, 6});
752 std::vector<IValue> args{self0, other0};
753 testStaticRuntime(
754 script,
755 args,
756 {},
757 /*use_allclose=*/false,
758 /*use_equalnan=*/false,
759 /*check_resize=*/true);
760
761 auto self1 = at::rand({22, 22, 22});
762 auto other1 = at::rand({22, 22, 22});
763 std::vector<IValue> args2{self1, other1};
764 testStaticRuntime(
765 script,
766 args,
767 args2,
768 /*use_allclose=*/false,
769 /*use_equalnan=*/false,
770 /*check_resize=*/true);
771 }
772
TEST(StaticRuntime,autogen_logical_and)773 TEST(StaticRuntime, autogen_logical_and) {
774 const std::string script = R"IR(
775 graph(%self: Tensor, %other: Tensor):
776 %bias: None = prim::Constant()
777 %ret = aten::logical_and(%self, %other)
778 %cloned = aten::clone(%ret, %bias)
779 return (%cloned)
780 )IR";
781
782 auto self0 = at::rand({6, 6, 6});
783 auto other0 = at::rand({6, 6, 6});
784 std::vector<IValue> args{self0, other0};
785 testStaticRuntime(
786 script,
787 args,
788 {},
789 /*use_allclose=*/false,
790 /*use_equalnan=*/false,
791 /*check_resize=*/true);
792
793 auto self1 = at::rand({22, 22, 22});
794 auto other1 = at::rand({22, 22, 22});
795 std::vector<IValue> args2{self1, other1};
796 testStaticRuntime(
797 script,
798 args,
799 args2,
800 /*use_allclose=*/false,
801 /*use_equalnan=*/false,
802 /*check_resize=*/true);
803 }
804
TEST(StaticRuntime,autogen_logical_or)805 TEST(StaticRuntime, autogen_logical_or) {
806 const std::string script = R"IR(
807 graph(%self: Tensor, %other: Tensor):
808 %bias: None = prim::Constant()
809 %ret = aten::logical_or(%self, %other)
810 %cloned = aten::clone(%ret, %bias)
811 return (%cloned)
812 )IR";
813
814 auto self0 = at::rand({6, 6, 6});
815 auto other0 = at::rand({6, 6, 6});
816 std::vector<IValue> args{self0, other0};
817 testStaticRuntime(
818 script,
819 args,
820 {},
821 /*use_allclose=*/false,
822 /*use_equalnan=*/false,
823 /*check_resize=*/true);
824
825 auto self1 = at::rand({22, 22, 22});
826 auto other1 = at::rand({22, 22, 22});
827 std::vector<IValue> args2{self1, other1};
828 testStaticRuntime(
829 script,
830 args,
831 args2,
832 /*use_allclose=*/false,
833 /*use_equalnan=*/false,
834 /*check_resize=*/true);
835 }
836
TEST(StaticRuntime,autogen_ceil)837 TEST(StaticRuntime, autogen_ceil) {
838 const std::string script = R"IR(
839 graph(%self: Tensor):
840 %bias: None = prim::Constant()
841 %ret = aten::ceil(%self)
842 %cloned = aten::clone(%ret, %bias)
843 return (%cloned)
844 )IR";
845
846 auto self0 = at::rand({6, 6, 6});
847 std::vector<IValue> args{self0};
848 testStaticRuntime(
849 script,
850 args,
851 {},
852 /*use_allclose=*/false,
853 /*use_equalnan=*/false,
854 /*check_resize=*/true);
855
856 auto self1 = at::rand({22, 22, 22});
857 std::vector<IValue> args2{self1};
858 testStaticRuntime(
859 script,
860 args,
861 args2,
862 /*use_allclose=*/false,
863 /*use_equalnan=*/false,
864 /*check_resize=*/true);
865 }
866
TEST(StaticRuntime,autogen_clamp_max)867 TEST(StaticRuntime, autogen_clamp_max) {
868 const std::string script = R"IR(
869 graph(%self: Tensor, %max: int):
870 %bias: None = prim::Constant()
871 %ret = aten::clamp_max(%self, %max)
872 %cloned = aten::clone(%ret, %bias)
873 return (%cloned)
874 )IR";
875
876 auto self0 = at::rand({6, 6, 6});
877 auto max0 = 2;
878 std::vector<IValue> args{self0, max0};
879 testStaticRuntime(
880 script,
881 args,
882 {},
883 /*use_allclose=*/false,
884 /*use_equalnan=*/false,
885 /*check_resize=*/true);
886
887 auto self1 = at::rand({22, 22, 22});
888 auto max1 = 2;
889 std::vector<IValue> args2{self1, max1};
890 testStaticRuntime(
891 script,
892 args,
893 args2,
894 /*use_allclose=*/false,
895 /*use_equalnan=*/false,
896 /*check_resize=*/true);
897 }
898
TEST(StaticRuntime,autogen_clamp_max_Tensor)899 TEST(StaticRuntime, autogen_clamp_max_Tensor) {
900 const std::string script = R"IR(
901 graph(%self: Tensor, %max: Tensor):
902 %bias: None = prim::Constant()
903 %ret = aten::clamp_max(%self, %max)
904 %cloned = aten::clone(%ret, %bias)
905 return (%cloned)
906 )IR";
907
908 auto self0 = at::rand({6, 6, 6});
909 auto max0 = at::rand({6, 6, 6});
910 std::vector<IValue> args{self0, max0};
911 testStaticRuntime(
912 script,
913 args,
914 {},
915 /*use_allclose=*/false,
916 /*use_equalnan=*/false,
917 /*check_resize=*/true);
918
919 auto self1 = at::rand({22, 22, 22});
920 auto max1 = at::rand({22, 22, 22});
921 std::vector<IValue> args2{self1, max1};
922 testStaticRuntime(
923 script,
924 args,
925 args2,
926 /*use_allclose=*/false,
927 /*use_equalnan=*/false,
928 /*check_resize=*/true);
929 }
930
TEST(StaticRuntime,autogen_clip)931 TEST(StaticRuntime, autogen_clip) {
932 const std::string script = R"IR(
933 graph(%self: Tensor, %min: int?, %max: int?):
934 %bias: None = prim::Constant()
935 %ret = aten::clip(%self, %min, %max)
936 %cloned = aten::clone(%ret, %bias)
937 return (%cloned)
938 )IR";
939
940 auto self0 = at::rand({6, 6, 6});
941 auto min0 = 2;
942 auto max0 = 2;
943 std::vector<IValue> args{self0, min0, max0};
944 testStaticRuntime(
945 script,
946 args,
947 {},
948 /*use_allclose=*/false,
949 /*use_equalnan=*/false,
950 /*check_resize=*/true);
951
952 auto self1 = at::rand({22, 22, 22});
953 auto min1 = 2;
954 auto max1 = 2;
955 std::vector<IValue> args2{self1, min1, max1};
956 testStaticRuntime(
957 script,
958 args,
959 args2,
960 /*use_allclose=*/false,
961 /*use_equalnan=*/false,
962 /*check_resize=*/true);
963 }
964
TEST(StaticRuntime,autogen_complex)965 TEST(StaticRuntime, autogen_complex) {
966 const std::string script = R"IR(
967 graph(%real: Tensor, %imag: Tensor):
968 %bias: None = prim::Constant()
969 %ret = aten::complex(%real, %imag)
970 %cloned = aten::clone(%ret, %bias)
971 return (%cloned)
972 )IR";
973
974 auto real0 = at::rand({6, 6, 6});
975 auto imag0 = at::rand({6, 6, 6});
976 std::vector<IValue> args{real0, imag0};
977 testStaticRuntime(
978 script,
979 args,
980 {},
981 /*use_allclose=*/false,
982 /*use_equalnan=*/false,
983 /*check_resize=*/true);
984
985 auto real1 = at::rand({22, 22, 22});
986 auto imag1 = at::rand({22, 22, 22});
987 std::vector<IValue> args2{real1, imag1};
988 testStaticRuntime(
989 script,
990 args,
991 args2,
992 /*use_allclose=*/false,
993 /*use_equalnan=*/false,
994 /*check_resize=*/true);
995 }
996
TEST(StaticRuntime,autogen_polar)997 TEST(StaticRuntime, autogen_polar) {
998 const std::string script = R"IR(
999 graph(%abs: Tensor, %angle: Tensor):
1000 %bias: None = prim::Constant()
1001 %ret = aten::polar(%abs, %angle)
1002 %cloned = aten::clone(%ret, %bias)
1003 return (%cloned)
1004 )IR";
1005
1006 auto abs0 = at::rand({6, 6, 6});
1007 auto angle0 = at::rand({6, 6, 6});
1008 std::vector<IValue> args{abs0, angle0};
1009 testStaticRuntime(
1010 script,
1011 args,
1012 {},
1013 /*use_allclose=*/false,
1014 /*use_equalnan=*/false,
1015 /*check_resize=*/true);
1016
1017 auto abs1 = at::rand({22, 22, 22});
1018 auto angle1 = at::rand({22, 22, 22});
1019 std::vector<IValue> args2{abs1, angle1};
1020 testStaticRuntime(
1021 script,
1022 args,
1023 args2,
1024 /*use_allclose=*/false,
1025 /*use_equalnan=*/false,
1026 /*check_resize=*/true);
1027 }
1028
TEST(StaticRuntime,autogen_cos)1029 TEST(StaticRuntime, autogen_cos) {
1030 const std::string script = R"IR(
1031 graph(%self: Tensor):
1032 %bias: None = prim::Constant()
1033 %ret = aten::cos(%self)
1034 %cloned = aten::clone(%ret, %bias)
1035 return (%cloned)
1036 )IR";
1037
1038 auto self0 = at::rand({6, 6, 6});
1039 std::vector<IValue> args{self0};
1040 testStaticRuntime(
1041 script,
1042 args,
1043 {},
1044 /*use_allclose=*/false,
1045 /*use_equalnan=*/false,
1046 /*check_resize=*/true);
1047
1048 auto self1 = at::rand({22, 22, 22});
1049 std::vector<IValue> args2{self1};
1050 testStaticRuntime(
1051 script,
1052 args,
1053 args2,
1054 /*use_allclose=*/false,
1055 /*use_equalnan=*/false,
1056 /*check_resize=*/true);
1057 }
1058
TEST(StaticRuntime,autogen_cosh)1059 TEST(StaticRuntime, autogen_cosh) {
1060 const std::string script = R"IR(
1061 graph(%self: Tensor):
1062 %bias: None = prim::Constant()
1063 %ret = aten::cosh(%self)
1064 %cloned = aten::clone(%ret, %bias)
1065 return (%cloned)
1066 )IR";
1067
1068 auto self0 = at::rand({6, 6, 6});
1069 std::vector<IValue> args{self0};
1070 testStaticRuntime(
1071 script,
1072 args,
1073 {},
1074 /*use_allclose=*/false,
1075 /*use_equalnan=*/false,
1076 /*check_resize=*/true);
1077
1078 auto self1 = at::rand({22, 22, 22});
1079 std::vector<IValue> args2{self1};
1080 testStaticRuntime(
1081 script,
1082 args,
1083 args2,
1084 /*use_allclose=*/false,
1085 /*use_equalnan=*/false,
1086 /*check_resize=*/true);
1087 }
1088
TEST(StaticRuntime,autogen_cumprod)1089 TEST(StaticRuntime, autogen_cumprod) {
1090 const std::string script = R"IR(
1091 graph(%self: Tensor, %dim: int, %dtype: int?):
1092 %bias: None = prim::Constant()
1093 %ret = aten::cumprod(%self, %dim, %dtype)
1094 %cloned = aten::clone(%ret, %bias)
1095 return (%cloned)
1096 )IR";
1097
1098 auto self0 = at::rand({6, 6, 6});
1099 auto dim0 = 1;
1100 auto dtype0 = at::ScalarType::Float;
1101 std::vector<IValue> args{self0, dim0, dtype0};
1102 testStaticRuntime(
1103 script,
1104 args,
1105 {},
1106 /*use_allclose=*/false,
1107 /*use_equalnan=*/false,
1108 /*check_resize=*/true);
1109
1110 auto self1 = at::rand({22, 22, 22});
1111 auto dim1 = 1;
1112 auto dtype1 = at::ScalarType::Float;
1113 std::vector<IValue> args2{self1, dim1, dtype1};
1114 testStaticRuntime(
1115 script,
1116 args,
1117 args2,
1118 /*use_allclose=*/false,
1119 /*use_equalnan=*/false,
1120 /*check_resize=*/true);
1121 }
1122
TEST(StaticRuntime,autogen_diff)1123 TEST(StaticRuntime, autogen_diff) {
1124 const std::string script = R"IR(
1125 graph(%self: Tensor, %n: int, %dim: int, %prepend: Tensor?, %append: Tensor?):
1126 %bias: None = prim::Constant()
1127 %ret = aten::diff(%self, %n, %dim, %prepend, %append)
1128 %cloned = aten::clone(%ret, %bias)
1129 return (%cloned)
1130 )IR";
1131
1132 auto self0 = at::rand({6, 6, 6});
1133 auto n0 = 1;
1134 auto dim0 = 1;
1135 auto prepend0 = at::rand({6, 6, 6});
1136 auto append0 = at::rand({6, 6, 6});
1137 std::vector<IValue> args{self0, n0, dim0, prepend0, append0};
1138 testStaticRuntime(
1139 script,
1140 args,
1141 {},
1142 /*use_allclose=*/false,
1143 /*use_equalnan=*/false,
1144 /*check_resize=*/true);
1145
1146 auto self1 = at::rand({22, 22, 22});
1147 auto n1 = 1;
1148 auto dim1 = 1;
1149 auto prepend1 = at::rand({22, 22, 22});
1150 auto append1 = at::rand({22, 22, 22});
1151 std::vector<IValue> args2{self1, n1, dim1, prepend1, append1};
1152 testStaticRuntime(
1153 script,
1154 args,
1155 args2,
1156 /*use_allclose=*/false,
1157 /*use_equalnan=*/false,
1158 /*check_resize=*/true);
1159 }
1160
TEST(StaticRuntime,autogen_divide_Tensor)1161 TEST(StaticRuntime, autogen_divide_Tensor) {
1162 const std::string script = R"IR(
1163 graph(%self: Tensor, %other: Tensor):
1164 %bias: None = prim::Constant()
1165 %ret = aten::divide(%self, %other)
1166 %cloned = aten::clone(%ret, %bias)
1167 return (%cloned)
1168 )IR";
1169
1170 auto self0 = at::rand({6, 6, 6});
1171 auto other0 = at::rand({6, 6, 6});
1172 std::vector<IValue> args{self0, other0};
1173 testStaticRuntime(
1174 script,
1175 args,
1176 {},
1177 /*use_allclose=*/false,
1178 /*use_equalnan=*/false,
1179 /*check_resize=*/true);
1180
1181 auto self1 = at::rand({22, 22, 22});
1182 auto other1 = at::rand({22, 22, 22});
1183 std::vector<IValue> args2{self1, other1};
1184 testStaticRuntime(
1185 script,
1186 args,
1187 args2,
1188 /*use_allclose=*/false,
1189 /*use_equalnan=*/false,
1190 /*check_resize=*/true);
1191 }
1192
TEST(StaticRuntime,autogen_true_divide_Tensor)1193 TEST(StaticRuntime, autogen_true_divide_Tensor) {
1194 const std::string script = R"IR(
1195 graph(%self: Tensor, %other: Tensor):
1196 %bias: None = prim::Constant()
1197 %ret = aten::true_divide(%self, %other)
1198 %cloned = aten::clone(%ret, %bias)
1199 return (%cloned)
1200 )IR";
1201
1202 auto self0 = at::rand({6, 6, 6});
1203 auto other0 = at::rand({6, 6, 6});
1204 std::vector<IValue> args{self0, other0};
1205 testStaticRuntime(
1206 script,
1207 args,
1208 {},
1209 /*use_allclose=*/false,
1210 /*use_equalnan=*/false,
1211 /*check_resize=*/true);
1212
1213 auto self1 = at::rand({22, 22, 22});
1214 auto other1 = at::rand({22, 22, 22});
1215 std::vector<IValue> args2{self1, other1};
1216 testStaticRuntime(
1217 script,
1218 args,
1219 args2,
1220 /*use_allclose=*/false,
1221 /*use_equalnan=*/false,
1222 /*check_resize=*/true);
1223 }
1224
TEST(StaticRuntime,autogen_dot)1225 TEST(StaticRuntime, autogen_dot) {
1226 const std::string script = R"IR(
1227 graph(%self: Tensor, %tensor: Tensor):
1228 %bias: None = prim::Constant()
1229 %ret = aten::dot(%self, %tensor)
1230 %cloned = aten::clone(%ret, %bias)
1231 return (%cloned)
1232 )IR";
1233
1234 auto self0 = at::rand({16});
1235 auto tensor0 = at::rand({16});
1236 std::vector<IValue> args{self0, tensor0};
1237 testStaticRuntime(
1238 script,
1239 args,
1240 {},
1241 /*use_allclose=*/false,
1242 /*use_equalnan=*/false,
1243 /*check_resize=*/false);
1244
1245 auto self1 = at::rand({64});
1246 auto tensor1 = at::rand({64});
1247 std::vector<IValue> args2{self1, tensor1};
1248 testStaticRuntime(
1249 script,
1250 args,
1251 args2,
1252 /*use_allclose=*/false,
1253 /*use_equalnan=*/false,
1254 /*check_resize=*/false);
1255 }
1256
TEST(StaticRuntime,autogen_vdot)1257 TEST(StaticRuntime, autogen_vdot) {
1258 const std::string script = R"IR(
1259 graph(%self: Tensor, %other: Tensor):
1260 %bias: None = prim::Constant()
1261 %ret = aten::vdot(%self, %other)
1262 %cloned = aten::clone(%ret, %bias)
1263 return (%cloned)
1264 )IR";
1265
1266 auto self0 = at::rand({16});
1267 auto other0 = at::rand({16});
1268 std::vector<IValue> args{self0, other0};
1269 testStaticRuntime(
1270 script,
1271 args,
1272 {},
1273 /*use_allclose=*/false,
1274 /*use_equalnan=*/false,
1275 /*check_resize=*/false);
1276
1277 auto self1 = at::rand({64});
1278 auto other1 = at::rand({64});
1279 std::vector<IValue> args2{self1, other1};
1280 testStaticRuntime(
1281 script,
1282 args,
1283 args2,
1284 /*use_allclose=*/false,
1285 /*use_equalnan=*/false,
1286 /*check_resize=*/false);
1287 }
1288
TEST(StaticRuntime,autogen_erf)1289 TEST(StaticRuntime, autogen_erf) {
1290 const std::string script = R"IR(
1291 graph(%self: Tensor):
1292 %bias: None = prim::Constant()
1293 %ret = aten::erf(%self)
1294 %cloned = aten::clone(%ret, %bias)
1295 return (%cloned)
1296 )IR";
1297
1298 auto self0 = at::rand({6, 6, 6});
1299 std::vector<IValue> args{self0};
1300 testStaticRuntime(
1301 script,
1302 args,
1303 {},
1304 /*use_allclose=*/false,
1305 /*use_equalnan=*/false,
1306 /*check_resize=*/true);
1307
1308 auto self1 = at::rand({22, 22, 22});
1309 std::vector<IValue> args2{self1};
1310 testStaticRuntime(
1311 script,
1312 args,
1313 args2,
1314 /*use_allclose=*/false,
1315 /*use_equalnan=*/false,
1316 /*check_resize=*/true);
1317 }
1318
TEST(StaticRuntime,autogen_erfc)1319 TEST(StaticRuntime, autogen_erfc) {
1320 const std::string script = R"IR(
1321 graph(%self: Tensor):
1322 %bias: None = prim::Constant()
1323 %ret = aten::erfc(%self)
1324 %cloned = aten::clone(%ret, %bias)
1325 return (%cloned)
1326 )IR";
1327
1328 auto self0 = at::rand({6, 6, 6});
1329 std::vector<IValue> args{self0};
1330 testStaticRuntime(
1331 script,
1332 args,
1333 {},
1334 /*use_allclose=*/false,
1335 /*use_equalnan=*/false,
1336 /*check_resize=*/true);
1337
1338 auto self1 = at::rand({22, 22, 22});
1339 std::vector<IValue> args2{self1};
1340 testStaticRuntime(
1341 script,
1342 args,
1343 args2,
1344 /*use_allclose=*/false,
1345 /*use_equalnan=*/false,
1346 /*check_resize=*/true);
1347 }
1348
TEST(StaticRuntime,autogen_exp)1349 TEST(StaticRuntime, autogen_exp) {
1350 const std::string script = R"IR(
1351 graph(%self: Tensor):
1352 %bias: None = prim::Constant()
1353 %ret = aten::exp(%self)
1354 %cloned = aten::clone(%ret, %bias)
1355 return (%cloned)
1356 )IR";
1357
1358 auto self0 = at::rand({6, 6, 6});
1359 std::vector<IValue> args{self0};
1360 testStaticRuntime(
1361 script,
1362 args,
1363 {},
1364 /*use_allclose=*/false,
1365 /*use_equalnan=*/false,
1366 /*check_resize=*/true);
1367
1368 auto self1 = at::rand({22, 22, 22});
1369 std::vector<IValue> args2{self1};
1370 testStaticRuntime(
1371 script,
1372 args,
1373 args2,
1374 /*use_allclose=*/false,
1375 /*use_equalnan=*/false,
1376 /*check_resize=*/true);
1377 }
1378
TEST(StaticRuntime,autogen_exp2)1379 TEST(StaticRuntime, autogen_exp2) {
1380 const std::string script = R"IR(
1381 graph(%self: Tensor):
1382 %bias: None = prim::Constant()
1383 %ret = aten::exp2(%self)
1384 %cloned = aten::clone(%ret, %bias)
1385 return (%cloned)
1386 )IR";
1387
1388 auto self0 = at::rand({6, 6, 6});
1389 std::vector<IValue> args{self0};
1390 testStaticRuntime(
1391 script,
1392 args,
1393 {},
1394 /*use_allclose=*/false,
1395 /*use_equalnan=*/false,
1396 /*check_resize=*/true);
1397
1398 auto self1 = at::rand({22, 22, 22});
1399 std::vector<IValue> args2{self1};
1400 testStaticRuntime(
1401 script,
1402 args,
1403 args2,
1404 /*use_allclose=*/false,
1405 /*use_equalnan=*/false,
1406 /*check_resize=*/true);
1407 }
1408
TEST(StaticRuntime,autogen_expm1)1409 TEST(StaticRuntime, autogen_expm1) {
1410 const std::string script = R"IR(
1411 graph(%self: Tensor):
1412 %bias: None = prim::Constant()
1413 %ret = aten::expm1(%self)
1414 %cloned = aten::clone(%ret, %bias)
1415 return (%cloned)
1416 )IR";
1417
1418 auto self0 = at::rand({6, 6, 6});
1419 std::vector<IValue> args{self0};
1420 testStaticRuntime(
1421 script,
1422 args,
1423 {},
1424 /*use_allclose=*/false,
1425 /*use_equalnan=*/false,
1426 /*check_resize=*/true);
1427
1428 auto self1 = at::rand({22, 22, 22});
1429 std::vector<IValue> args2{self1};
1430 testStaticRuntime(
1431 script,
1432 args,
1433 args2,
1434 /*use_allclose=*/false,
1435 /*use_equalnan=*/false,
1436 /*check_resize=*/true);
1437 }
1438
TEST(StaticRuntime,autogen_floor)1439 TEST(StaticRuntime, autogen_floor) {
1440 const std::string script = R"IR(
1441 graph(%self: Tensor):
1442 %bias: None = prim::Constant()
1443 %ret = aten::floor(%self)
1444 %cloned = aten::clone(%ret, %bias)
1445 return (%cloned)
1446 )IR";
1447
1448 auto self0 = at::rand({6, 6, 6});
1449 std::vector<IValue> args{self0};
1450 testStaticRuntime(
1451 script,
1452 args,
1453 {},
1454 /*use_allclose=*/false,
1455 /*use_equalnan=*/false,
1456 /*check_resize=*/true);
1457
1458 auto self1 = at::rand({22, 22, 22});
1459 std::vector<IValue> args2{self1};
1460 testStaticRuntime(
1461 script,
1462 args,
1463 args2,
1464 /*use_allclose=*/false,
1465 /*use_equalnan=*/false,
1466 /*check_resize=*/true);
1467 }
1468
TEST(StaticRuntime,autogen_frac)1469 TEST(StaticRuntime, autogen_frac) {
1470 const std::string script = R"IR(
1471 graph(%self: Tensor):
1472 %bias: None = prim::Constant()
1473 %ret = aten::frac(%self)
1474 %cloned = aten::clone(%ret, %bias)
1475 return (%cloned)
1476 )IR";
1477
1478 auto self0 = at::rand({6, 6, 6});
1479 std::vector<IValue> args{self0};
1480 testStaticRuntime(
1481 script,
1482 args,
1483 {},
1484 /*use_allclose=*/false,
1485 /*use_equalnan=*/false,
1486 /*check_resize=*/true);
1487
1488 auto self1 = at::rand({22, 22, 22});
1489 std::vector<IValue> args2{self1};
1490 testStaticRuntime(
1491 script,
1492 args,
1493 args2,
1494 /*use_allclose=*/false,
1495 /*use_equalnan=*/false,
1496 /*check_resize=*/true);
1497 }
1498
TEST(StaticRuntime,autogen_gcd)1499 TEST(StaticRuntime, autogen_gcd) {
1500 const std::string script = R"IR(
1501 graph(%self: Tensor, %other: Tensor):
1502 %bias: None = prim::Constant()
1503 %ret = aten::gcd(%self, %other)
1504 %cloned = aten::clone(%ret, %bias)
1505 return (%cloned)
1506 )IR";
1507
1508 auto self0 = at::randint(1, 100, {6, 6, 6}, at::kInt);
1509 auto other0 = at::randint(1, 100, {6, 6, 6}, at::kInt);
1510 std::vector<IValue> args{self0, other0};
1511 testStaticRuntime(
1512 script,
1513 args,
1514 {},
1515 /*use_allclose=*/false,
1516 /*use_equalnan=*/false,
1517 /*check_resize=*/true);
1518
1519 auto self1 = at::randint(1, 100, {22, 22, 22}, at::kInt);
1520 auto other1 = at::randint(1, 100, {22, 22, 22}, at::kInt);
1521 std::vector<IValue> args2{self1, other1};
1522 testStaticRuntime(
1523 script,
1524 args,
1525 args2,
1526 /*use_allclose=*/false,
1527 /*use_equalnan=*/false,
1528 /*check_resize=*/true);
1529 }
1530
TEST(StaticRuntime,autogen_lcm)1531 TEST(StaticRuntime, autogen_lcm) {
1532 const std::string script = R"IR(
1533 graph(%self: Tensor, %other: Tensor):
1534 %bias: None = prim::Constant()
1535 %ret = aten::lcm(%self, %other)
1536 %cloned = aten::clone(%ret, %bias)
1537 return (%cloned)
1538 )IR";
1539
1540 auto self0 = at::randint(1, 100, {6, 6, 6}, at::kInt);
1541 auto other0 = at::randint(1, 100, {6, 6, 6}, at::kInt);
1542 std::vector<IValue> args{self0, other0};
1543 testStaticRuntime(
1544 script,
1545 args,
1546 {},
1547 /*use_allclose=*/false,
1548 /*use_equalnan=*/false,
1549 /*check_resize=*/true);
1550
1551 auto self1 = at::randint(1, 100, {22, 22, 22}, at::kInt);
1552 auto other1 = at::randint(1, 100, {22, 22, 22}, at::kInt);
1553 std::vector<IValue> args2{self1, other1};
1554 testStaticRuntime(
1555 script,
1556 args,
1557 args2,
1558 /*use_allclose=*/false,
1559 /*use_equalnan=*/false,
1560 /*check_resize=*/true);
1561 }
1562
TEST(StaticRuntime,autogen_index_copy)1563 TEST(StaticRuntime, autogen_index_copy) {
1564 const std::string script = R"IR(
1565 graph(%self: Tensor, %dim: int, %index: Tensor, %source: Tensor):
1566 %bias: None = prim::Constant()
1567 %ret = aten::index_copy(%self, %dim, %index, %source)
1568 %cloned = aten::clone(%ret, %bias)
1569 return (%cloned)
1570 )IR";
1571
1572 auto self0 = at::rand({2});
1573 auto dim0 = 0;
1574 auto index0 = at::randint(0, 1, {2}, at::kLong);
1575 auto source0 = at::rand({2});
1576 std::vector<IValue> args{self0, dim0, index0, source0};
1577 testStaticRuntime(
1578 script,
1579 args,
1580 {},
1581 /*use_allclose=*/false,
1582 /*use_equalnan=*/false,
1583 /*check_resize=*/true);
1584
1585 auto self1 = at::rand({32});
1586 auto dim1 = 0;
1587 auto index1 = at::randint(0, 10, {32}, at::kLong);
1588 auto source1 = at::rand({32});
1589 std::vector<IValue> args2{self1, dim1, index1, source1};
1590 testStaticRuntime(
1591 script,
1592 args,
1593 args2,
1594 /*use_allclose=*/false,
1595 /*use_equalnan=*/false,
1596 /*check_resize=*/true);
1597 }
1598
TEST(StaticRuntime,autogen_isin_Tensor_Tensor)1599 TEST(StaticRuntime, autogen_isin_Tensor_Tensor) {
1600 const std::string script = R"IR(
1601 graph(%elements: Tensor, %test_elements: Tensor, %assume_unique: bool, %invert: bool):
1602 %bias: None = prim::Constant()
1603 %ret = aten::isin(%elements, %test_elements, %assume_unique, %invert)
1604 %cloned = aten::clone(%ret, %bias)
1605 return (%cloned)
1606 )IR";
1607
1608 auto elements0 = at::rand({6, 6, 6});
1609 auto test_elements0 = at::rand({6, 6, 6});
1610 auto assume_unique0 = false;
1611 auto invert0 = false;
1612 std::vector<IValue> args{elements0, test_elements0, assume_unique0, invert0};
1613 testStaticRuntime(
1614 script,
1615 args,
1616 {},
1617 /*use_allclose=*/false,
1618 /*use_equalnan=*/false,
1619 /*check_resize=*/true);
1620
1621 auto elements1 = at::rand({22, 22, 22});
1622 auto test_elements1 = at::rand({22, 22, 22});
1623 auto assume_unique1 = false;
1624 auto invert1 = false;
1625 std::vector<IValue> args2{elements1, test_elements1, assume_unique1, invert1};
1626 testStaticRuntime(
1627 script,
1628 args,
1629 args2,
1630 /*use_allclose=*/false,
1631 /*use_equalnan=*/false,
1632 /*check_resize=*/true);
1633 }
1634
TEST(StaticRuntime,autogen_isin_Tensor_Scalar)1635 TEST(StaticRuntime, autogen_isin_Tensor_Scalar) {
1636 const std::string script = R"IR(
1637 graph(%elements: Tensor, %test_element: int, %assume_unique: bool, %invert: bool):
1638 %bias: None = prim::Constant()
1639 %ret = aten::isin(%elements, %test_element, %assume_unique, %invert)
1640 %cloned = aten::clone(%ret, %bias)
1641 return (%cloned)
1642 )IR";
1643
1644 auto elements0 = at::rand({6, 6, 6});
1645 auto test_element0 = 2;
1646 auto assume_unique0 = false;
1647 auto invert0 = false;
1648 std::vector<IValue> args{elements0, test_element0, assume_unique0, invert0};
1649 testStaticRuntime(
1650 script,
1651 args,
1652 {},
1653 /*use_allclose=*/false,
1654 /*use_equalnan=*/false,
1655 /*check_resize=*/true);
1656
1657 auto elements1 = at::rand({22, 22, 22});
1658 auto test_element1 = 2;
1659 auto assume_unique1 = false;
1660 auto invert1 = false;
1661 std::vector<IValue> args2{elements1, test_element1, assume_unique1, invert1};
1662 testStaticRuntime(
1663 script,
1664 args,
1665 args2,
1666 /*use_allclose=*/false,
1667 /*use_equalnan=*/false,
1668 /*check_resize=*/true);
1669 }
1670
TEST(StaticRuntime,autogen_isin_Scalar_Tensor)1671 TEST(StaticRuntime, autogen_isin_Scalar_Tensor) {
1672 const std::string script = R"IR(
1673 graph(%element: int, %test_elements: Tensor, %assume_unique: bool, %invert: bool):
1674 %bias: None = prim::Constant()
1675 %ret = aten::isin(%element, %test_elements, %assume_unique, %invert)
1676 %cloned = aten::clone(%ret, %bias)
1677 return (%cloned)
1678 )IR";
1679
1680 auto element0 = 2;
1681 auto test_elements0 = at::rand({6, 6, 6});
1682 auto assume_unique0 = false;
1683 auto invert0 = false;
1684 std::vector<IValue> args{element0, test_elements0, assume_unique0, invert0};
1685 testStaticRuntime(
1686 script,
1687 args,
1688 {},
1689 /*use_allclose=*/false,
1690 /*use_equalnan=*/false,
1691 /*check_resize=*/false);
1692
1693 auto element1 = 2;
1694 auto test_elements1 = at::rand({22, 22, 22});
1695 auto assume_unique1 = false;
1696 auto invert1 = false;
1697 std::vector<IValue> args2{element1, test_elements1, assume_unique1, invert1};
1698 testStaticRuntime(
1699 script,
1700 args,
1701 args2,
1702 /*use_allclose=*/false,
1703 /*use_equalnan=*/false,
1704 /*check_resize=*/false);
1705 }
1706
TEST(StaticRuntime,autogen_kron)1707 TEST(StaticRuntime, autogen_kron) {
1708 const std::string script = R"IR(
1709 graph(%self: Tensor, %other: Tensor):
1710 %bias: None = prim::Constant()
1711 %ret = aten::kron(%self, %other)
1712 %cloned = aten::clone(%ret, %bias)
1713 return (%cloned)
1714 )IR";
1715
1716 auto self0 = at::rand({6, 6, 6});
1717 auto other0 = at::rand({6, 6, 6});
1718 std::vector<IValue> args{self0, other0};
1719 testStaticRuntime(
1720 script,
1721 args,
1722 {},
1723 /*use_allclose=*/false,
1724 /*use_equalnan=*/false,
1725 /*check_resize=*/true);
1726
1727 auto self1 = at::rand({22, 22, 22});
1728 auto other1 = at::rand({22, 22, 22});
1729 std::vector<IValue> args2{self1, other1};
1730 testStaticRuntime(
1731 script,
1732 args,
1733 args2,
1734 /*use_allclose=*/false,
1735 /*use_equalnan=*/false,
1736 /*check_resize=*/true);
1737 }
1738
TEST(StaticRuntime,autogen_ldexp_Tensor)1739 TEST(StaticRuntime, autogen_ldexp_Tensor) {
1740 const std::string script = R"IR(
1741 graph(%self: Tensor, %other: Tensor):
1742 %bias: None = prim::Constant()
1743 %ret = aten::ldexp(%self, %other)
1744 %cloned = aten::clone(%ret, %bias)
1745 return (%cloned)
1746 )IR";
1747
1748 auto self0 = at::rand({6, 6, 6});
1749 auto other0 = at::rand({6, 6, 6});
1750 std::vector<IValue> args{self0, other0};
1751 testStaticRuntime(
1752 script,
1753 args,
1754 {},
1755 /*use_allclose=*/false,
1756 /*use_equalnan=*/false,
1757 /*check_resize=*/true);
1758
1759 auto self1 = at::rand({22, 22, 22});
1760 auto other1 = at::rand({22, 22, 22});
1761 std::vector<IValue> args2{self1, other1};
1762 testStaticRuntime(
1763 script,
1764 args,
1765 args2,
1766 /*use_allclose=*/false,
1767 /*use_equalnan=*/false,
1768 /*check_resize=*/true);
1769 }
1770
TEST(StaticRuntime,autogen_log10)1771 TEST(StaticRuntime, autogen_log10) {
1772 const std::string script = R"IR(
1773 graph(%self: Tensor):
1774 %bias: None = prim::Constant()
1775 %ret = aten::log10(%self)
1776 %cloned = aten::clone(%ret, %bias)
1777 return (%cloned)
1778 )IR";
1779
1780 auto self0 = at::rand({6, 6, 6});
1781 std::vector<IValue> args{self0};
1782 testStaticRuntime(
1783 script,
1784 args,
1785 {},
1786 /*use_allclose=*/false,
1787 /*use_equalnan=*/false,
1788 /*check_resize=*/true);
1789
1790 auto self1 = at::rand({22, 22, 22});
1791 std::vector<IValue> args2{self1};
1792 testStaticRuntime(
1793 script,
1794 args,
1795 args2,
1796 /*use_allclose=*/false,
1797 /*use_equalnan=*/false,
1798 /*check_resize=*/true);
1799 }
1800
TEST(StaticRuntime,autogen_log1p)1801 TEST(StaticRuntime, autogen_log1p) {
1802 const std::string script = R"IR(
1803 graph(%self: Tensor):
1804 %bias: None = prim::Constant()
1805 %ret = aten::log1p(%self)
1806 %cloned = aten::clone(%ret, %bias)
1807 return (%cloned)
1808 )IR";
1809
1810 auto self0 = at::rand({6, 6, 6});
1811 std::vector<IValue> args{self0};
1812 testStaticRuntime(
1813 script,
1814 args,
1815 {},
1816 /*use_allclose=*/false,
1817 /*use_equalnan=*/false,
1818 /*check_resize=*/true);
1819
1820 auto self1 = at::rand({22, 22, 22});
1821 std::vector<IValue> args2{self1};
1822 testStaticRuntime(
1823 script,
1824 args,
1825 args2,
1826 /*use_allclose=*/false,
1827 /*use_equalnan=*/false,
1828 /*check_resize=*/true);
1829 }
1830
TEST(StaticRuntime,autogen_log2)1831 TEST(StaticRuntime, autogen_log2) {
1832 const std::string script = R"IR(
1833 graph(%self: Tensor):
1834 %bias: None = prim::Constant()
1835 %ret = aten::log2(%self)
1836 %cloned = aten::clone(%ret, %bias)
1837 return (%cloned)
1838 )IR";
1839
1840 auto self0 = at::rand({6, 6, 6});
1841 std::vector<IValue> args{self0};
1842 testStaticRuntime(
1843 script,
1844 args,
1845 {},
1846 /*use_allclose=*/false,
1847 /*use_equalnan=*/false,
1848 /*check_resize=*/true);
1849
1850 auto self1 = at::rand({22, 22, 22});
1851 std::vector<IValue> args2{self1};
1852 testStaticRuntime(
1853 script,
1854 args,
1855 args2,
1856 /*use_allclose=*/false,
1857 /*use_equalnan=*/false,
1858 /*check_resize=*/true);
1859 }
1860
TEST(StaticRuntime,autogen_logaddexp)1861 TEST(StaticRuntime, autogen_logaddexp) {
1862 const std::string script = R"IR(
1863 graph(%self: Tensor, %other: Tensor):
1864 %bias: None = prim::Constant()
1865 %ret = aten::logaddexp(%self, %other)
1866 %cloned = aten::clone(%ret, %bias)
1867 return (%cloned)
1868 )IR";
1869
1870 auto self0 = at::rand({6, 6, 6});
1871 auto other0 = at::rand({6, 6, 6});
1872 std::vector<IValue> args{self0, other0};
1873 testStaticRuntime(
1874 script,
1875 args,
1876 {},
1877 /*use_allclose=*/false,
1878 /*use_equalnan=*/false,
1879 /*check_resize=*/true);
1880
1881 auto self1 = at::rand({22, 22, 22});
1882 auto other1 = at::rand({22, 22, 22});
1883 std::vector<IValue> args2{self1, other1};
1884 testStaticRuntime(
1885 script,
1886 args,
1887 args2,
1888 /*use_allclose=*/false,
1889 /*use_equalnan=*/false,
1890 /*check_resize=*/true);
1891 }
1892
TEST(StaticRuntime,autogen_logaddexp2)1893 TEST(StaticRuntime, autogen_logaddexp2) {
1894 const std::string script = R"IR(
1895 graph(%self: Tensor, %other: Tensor):
1896 %bias: None = prim::Constant()
1897 %ret = aten::logaddexp2(%self, %other)
1898 %cloned = aten::clone(%ret, %bias)
1899 return (%cloned)
1900 )IR";
1901
1902 auto self0 = at::rand({6, 6, 6});
1903 auto other0 = at::rand({6, 6, 6});
1904 std::vector<IValue> args{self0, other0};
1905 testStaticRuntime(
1906 script,
1907 args,
1908 {},
1909 /*use_allclose=*/false,
1910 /*use_equalnan=*/false,
1911 /*check_resize=*/true);
1912
1913 auto self1 = at::rand({22, 22, 22});
1914 auto other1 = at::rand({22, 22, 22});
1915 std::vector<IValue> args2{self1, other1};
1916 testStaticRuntime(
1917 script,
1918 args,
1919 args2,
1920 /*use_allclose=*/false,
1921 /*use_equalnan=*/false,
1922 /*check_resize=*/true);
1923 }
1924
TEST(StaticRuntime,autogen_xlogy_Tensor)1925 TEST(StaticRuntime, autogen_xlogy_Tensor) {
1926 const std::string script = R"IR(
1927 graph(%self: Tensor, %other: Tensor):
1928 %bias: None = prim::Constant()
1929 %ret = aten::xlogy(%self, %other)
1930 %cloned = aten::clone(%ret, %bias)
1931 return (%cloned)
1932 )IR";
1933
1934 auto self0 = at::rand({6, 6, 6});
1935 auto other0 = at::rand({6, 6, 6});
1936 std::vector<IValue> args{self0, other0};
1937 testStaticRuntime(
1938 script,
1939 args,
1940 {},
1941 /*use_allclose=*/false,
1942 /*use_equalnan=*/false,
1943 /*check_resize=*/true);
1944
1945 auto self1 = at::rand({22, 22, 22});
1946 auto other1 = at::rand({22, 22, 22});
1947 std::vector<IValue> args2{self1, other1};
1948 testStaticRuntime(
1949 script,
1950 args,
1951 args2,
1952 /*use_allclose=*/false,
1953 /*use_equalnan=*/false,
1954 /*check_resize=*/true);
1955 }
1956
TEST(StaticRuntime,autogen__log_softmax)1957 TEST(StaticRuntime, autogen__log_softmax) {
1958 const std::string script = R"IR(
1959 graph(%self: Tensor, %dim: int, %half_to_float: bool):
1960 %bias: None = prim::Constant()
1961 %ret = aten::_log_softmax(%self, %dim, %half_to_float)
1962 %cloned = aten::clone(%ret, %bias)
1963 return (%cloned)
1964 )IR";
1965
1966 auto self0 = at::rand({6, 6, 6});
1967 auto dim0 = 1;
1968 auto half_to_float0 = false;
1969 std::vector<IValue> args{self0, dim0, half_to_float0};
1970 testStaticRuntime(
1971 script,
1972 args,
1973 {},
1974 /*use_allclose=*/false,
1975 /*use_equalnan=*/false,
1976 /*check_resize=*/true);
1977
1978 auto self1 = at::rand({22, 22, 22});
1979 auto dim1 = 1;
1980 auto half_to_float1 = false;
1981 std::vector<IValue> args2{self1, dim1, half_to_float1};
1982 testStaticRuntime(
1983 script,
1984 args,
1985 args2,
1986 /*use_allclose=*/false,
1987 /*use_equalnan=*/false,
1988 /*check_resize=*/true);
1989 }
1990
TEST(StaticRuntime,autogen__log_softmax_backward_data)1991 TEST(StaticRuntime, autogen__log_softmax_backward_data) {
1992 const std::string script = R"IR(
1993 graph(%grad_output: Tensor, %output: Tensor, %dim: int, %input_dtype: int):
1994 %bias: None = prim::Constant()
1995 %ret = aten::_log_softmax_backward_data(%grad_output, %output, %dim, %input_dtype)
1996 %cloned = aten::clone(%ret, %bias)
1997 return (%cloned)
1998 )IR";
1999
2000 auto grad_output0 = at::rand({6, 6, 6});
2001 auto output0 = at::rand({6, 6, 6});
2002 auto dim0 = 1;
2003 auto input_dtype0 = at::ScalarType::Float;
2004 std::vector<IValue> args{grad_output0, output0, dim0, input_dtype0};
2005 testStaticRuntime(
2006 script,
2007 args,
2008 {},
2009 /*use_allclose=*/false,
2010 /*use_equalnan=*/false,
2011 /*check_resize=*/true);
2012
2013 auto grad_output1 = at::rand({22, 22, 22});
2014 auto output1 = at::rand({22, 22, 22});
2015 auto dim1 = 1;
2016 auto input_dtype1 = at::ScalarType::Float;
2017 std::vector<IValue> args2{grad_output1, output1, dim1, input_dtype1};
2018 testStaticRuntime(
2019 script,
2020 args,
2021 args2,
2022 /*use_allclose=*/false,
2023 /*use_equalnan=*/false,
2024 /*check_resize=*/true);
2025 }
2026
TEST(StaticRuntime,autogen__logcumsumexp)2027 TEST(StaticRuntime, autogen__logcumsumexp) {
2028 const std::string script = R"IR(
2029 graph(%self: Tensor, %dim: int):
2030 %bias: None = prim::Constant()
2031 %ret = aten::_logcumsumexp(%self, %dim)
2032 %cloned = aten::clone(%ret, %bias)
2033 return (%cloned)
2034 )IR";
2035
2036 auto self0 = at::rand({6, 6, 6});
2037 auto dim0 = 1;
2038 std::vector<IValue> args{self0, dim0};
2039 testStaticRuntime(
2040 script,
2041 args,
2042 {},
2043 /*use_allclose=*/false,
2044 /*use_equalnan=*/false,
2045 /*check_resize=*/true);
2046
2047 auto self1 = at::rand({22, 22, 22});
2048 auto dim1 = 1;
2049 std::vector<IValue> args2{self1, dim1};
2050 testStaticRuntime(
2051 script,
2052 args,
2053 args2,
2054 /*use_allclose=*/false,
2055 /*use_equalnan=*/false,
2056 /*check_resize=*/true);
2057 }
2058
TEST(StaticRuntime,autogen_logcumsumexp)2059 TEST(StaticRuntime, autogen_logcumsumexp) {
2060 const std::string script = R"IR(
2061 graph(%self: Tensor, %dim: int):
2062 %bias: None = prim::Constant()
2063 %ret = aten::logcumsumexp(%self, %dim)
2064 %cloned = aten::clone(%ret, %bias)
2065 return (%cloned)
2066 )IR";
2067
2068 auto self0 = at::rand({6, 6, 6});
2069 auto dim0 = 1;
2070 std::vector<IValue> args{self0, dim0};
2071 testStaticRuntime(
2072 script,
2073 args,
2074 {},
2075 /*use_allclose=*/false,
2076 /*use_equalnan=*/false,
2077 /*check_resize=*/true);
2078
2079 auto self1 = at::rand({22, 22, 22});
2080 auto dim1 = 1;
2081 std::vector<IValue> args2{self1, dim1};
2082 testStaticRuntime(
2083 script,
2084 args,
2085 args2,
2086 /*use_allclose=*/false,
2087 /*use_equalnan=*/false,
2088 /*check_resize=*/true);
2089 }
2090
TEST(StaticRuntime,autogen_matrix_power)2091 TEST(StaticRuntime, autogen_matrix_power) {
2092 const std::string script = R"IR(
2093 graph(%self: Tensor, %n: int):
2094 %bias: None = prim::Constant()
2095 %ret = aten::matrix_power(%self, %n)
2096 %cloned = aten::clone(%ret, %bias)
2097 return (%cloned)
2098 )IR";
2099
2100 auto self0 = at::rand({6, 6, 6});
2101 auto n0 = 1;
2102 std::vector<IValue> args{self0, n0};
2103 testStaticRuntime(
2104 script,
2105 args,
2106 {},
2107 /*use_allclose=*/false,
2108 /*use_equalnan=*/false,
2109 /*check_resize=*/true);
2110
2111 auto self1 = at::rand({22, 22, 22});
2112 auto n1 = 1;
2113 std::vector<IValue> args2{self1, n1};
2114 testStaticRuntime(
2115 script,
2116 args,
2117 args2,
2118 /*use_allclose=*/false,
2119 /*use_equalnan=*/false,
2120 /*check_resize=*/true);
2121 }
2122
TEST(StaticRuntime,autogen_mm)2123 TEST(StaticRuntime, autogen_mm) {
2124 const std::string script = R"IR(
2125 graph(%self: Tensor, %mat2: Tensor):
2126 %bias: None = prim::Constant()
2127 %ret = aten::mm(%self, %mat2)
2128 %cloned = aten::clone(%ret, %bias)
2129 return (%cloned)
2130 )IR";
2131
2132 auto self0 = at::rand({8, 8});
2133 auto mat20 = at::rand({8, 8});
2134 std::vector<IValue> args{self0, mat20};
2135 testStaticRuntime(
2136 script,
2137 args,
2138 {},
2139 /*use_allclose=*/false,
2140 /*use_equalnan=*/false,
2141 /*check_resize=*/true);
2142
2143 auto self1 = at::rand({32, 32});
2144 auto mat21 = at::rand({32, 32});
2145 std::vector<IValue> args2{self1, mat21};
2146 testStaticRuntime(
2147 script,
2148 args,
2149 args2,
2150 /*use_allclose=*/false,
2151 /*use_equalnan=*/false,
2152 /*check_resize=*/true);
2153 }
2154
TEST(StaticRuntime,autogen_multiply_Tensor)2155 TEST(StaticRuntime, autogen_multiply_Tensor) {
2156 const std::string script = R"IR(
2157 graph(%self: Tensor, %other: Tensor):
2158 %bias: None = prim::Constant()
2159 %ret = aten::multiply(%self, %other)
2160 %cloned = aten::clone(%ret, %bias)
2161 return (%cloned)
2162 )IR";
2163
2164 auto self0 = at::rand({6, 6, 6});
2165 auto other0 = at::rand({6, 6, 6});
2166 std::vector<IValue> args{self0, other0};
2167 testStaticRuntime(
2168 script,
2169 args,
2170 {},
2171 /*use_allclose=*/false,
2172 /*use_equalnan=*/false,
2173 /*check_resize=*/true);
2174
2175 auto self1 = at::rand({22, 22, 22});
2176 auto other1 = at::rand({22, 22, 22});
2177 std::vector<IValue> args2{self1, other1};
2178 testStaticRuntime(
2179 script,
2180 args,
2181 args2,
2182 /*use_allclose=*/false,
2183 /*use_equalnan=*/false,
2184 /*check_resize=*/true);
2185 }
2186
TEST(StaticRuntime,autogen_mv)2187 TEST(StaticRuntime, autogen_mv) {
2188 const std::string script = R"IR(
2189 graph(%self: Tensor, %vec: Tensor):
2190 %bias: None = prim::Constant()
2191 %ret = aten::mv(%self, %vec)
2192 %cloned = aten::clone(%ret, %bias)
2193 return (%cloned)
2194 )IR";
2195
2196 auto self0 = at::rand({6, 6});
2197 auto vec0 = at::rand({6});
2198 std::vector<IValue> args{self0, vec0};
2199 testStaticRuntime(
2200 script,
2201 args,
2202 {},
2203 /*use_allclose=*/false,
2204 /*use_equalnan=*/false,
2205 /*check_resize=*/true);
2206
2207 auto self1 = at::rand({22, 22});
2208 auto vec1 = at::rand({22});
2209 std::vector<IValue> args2{self1, vec1};
2210 testStaticRuntime(
2211 script,
2212 args,
2213 args2,
2214 /*use_allclose=*/false,
2215 /*use_equalnan=*/false,
2216 /*check_resize=*/true);
2217 }
2218
TEST(StaticRuntime,autogen_mvlgamma)2219 TEST(StaticRuntime, autogen_mvlgamma) {
2220 const std::string script = R"IR(
2221 graph(%self: Tensor, %p: int):
2222 %bias: None = prim::Constant()
2223 %ret = aten::mvlgamma(%self, %p)
2224 %cloned = aten::clone(%ret, %bias)
2225 return (%cloned)
2226 )IR";
2227
2228 auto self0 = at::rand({6, 6, 6});
2229 auto p0 = 1;
2230 std::vector<IValue> args{self0, p0};
2231 testStaticRuntime(
2232 script,
2233 args,
2234 {},
2235 /*use_allclose=*/false,
2236 /*use_equalnan=*/false,
2237 /*check_resize=*/true);
2238
2239 auto self1 = at::rand({22, 22, 22});
2240 auto p1 = 1;
2241 std::vector<IValue> args2{self1, p1};
2242 testStaticRuntime(
2243 script,
2244 args,
2245 args2,
2246 /*use_allclose=*/false,
2247 /*use_equalnan=*/false,
2248 /*check_resize=*/true);
2249 }
2250
TEST(StaticRuntime,autogen_rad2deg)2251 TEST(StaticRuntime, autogen_rad2deg) {
2252 const std::string script = R"IR(
2253 graph(%self: Tensor):
2254 %bias: None = prim::Constant()
2255 %ret = aten::rad2deg(%self)
2256 %cloned = aten::clone(%ret, %bias)
2257 return (%cloned)
2258 )IR";
2259
2260 auto self0 = at::rand({6, 6, 6});
2261 std::vector<IValue> args{self0};
2262 testStaticRuntime(
2263 script,
2264 args,
2265 {},
2266 /*use_allclose=*/false,
2267 /*use_equalnan=*/false,
2268 /*check_resize=*/true);
2269
2270 auto self1 = at::rand({22, 22, 22});
2271 std::vector<IValue> args2{self1};
2272 testStaticRuntime(
2273 script,
2274 args,
2275 args2,
2276 /*use_allclose=*/false,
2277 /*use_equalnan=*/false,
2278 /*check_resize=*/true);
2279 }
2280
TEST(StaticRuntime,autogen_deg2rad)2281 TEST(StaticRuntime, autogen_deg2rad) {
2282 const std::string script = R"IR(
2283 graph(%self: Tensor):
2284 %bias: None = prim::Constant()
2285 %ret = aten::deg2rad(%self)
2286 %cloned = aten::clone(%ret, %bias)
2287 return (%cloned)
2288 )IR";
2289
2290 auto self0 = at::rand({6, 6, 6});
2291 std::vector<IValue> args{self0};
2292 testStaticRuntime(
2293 script,
2294 args,
2295 {},
2296 /*use_allclose=*/false,
2297 /*use_equalnan=*/false,
2298 /*check_resize=*/true);
2299
2300 auto self1 = at::rand({22, 22, 22});
2301 std::vector<IValue> args2{self1};
2302 testStaticRuntime(
2303 script,
2304 args,
2305 args2,
2306 /*use_allclose=*/false,
2307 /*use_equalnan=*/false,
2308 /*check_resize=*/true);
2309 }
2310
TEST(StaticRuntime,autogen_reciprocal)2311 TEST(StaticRuntime, autogen_reciprocal) {
2312 const std::string script = R"IR(
2313 graph(%self: Tensor):
2314 %bias: None = prim::Constant()
2315 %ret = aten::reciprocal(%self)
2316 %cloned = aten::clone(%ret, %bias)
2317 return (%cloned)
2318 )IR";
2319
2320 auto self0 = at::rand({6, 6, 6});
2321 std::vector<IValue> args{self0};
2322 testStaticRuntime(
2323 script,
2324 args,
2325 {},
2326 /*use_allclose=*/false,
2327 /*use_equalnan=*/false,
2328 /*check_resize=*/true);
2329
2330 auto self1 = at::rand({22, 22, 22});
2331 std::vector<IValue> args2{self1};
2332 testStaticRuntime(
2333 script,
2334 args,
2335 args2,
2336 /*use_allclose=*/false,
2337 /*use_equalnan=*/false,
2338 /*check_resize=*/true);
2339 }
2340
TEST(StaticRuntime,autogen_neg)2341 TEST(StaticRuntime, autogen_neg) {
2342 const std::string script = R"IR(
2343 graph(%self: Tensor):
2344 %bias: None = prim::Constant()
2345 %ret = aten::neg(%self)
2346 %cloned = aten::clone(%ret, %bias)
2347 return (%cloned)
2348 )IR";
2349
2350 auto self0 = at::rand({6, 6, 6});
2351 std::vector<IValue> args{self0};
2352 testStaticRuntime(
2353 script,
2354 args,
2355 {},
2356 /*use_allclose=*/false,
2357 /*use_equalnan=*/false,
2358 /*check_resize=*/true);
2359
2360 auto self1 = at::rand({22, 22, 22});
2361 std::vector<IValue> args2{self1};
2362 testStaticRuntime(
2363 script,
2364 args,
2365 args2,
2366 /*use_allclose=*/false,
2367 /*use_equalnan=*/false,
2368 /*check_resize=*/true);
2369 }
2370
TEST(StaticRuntime,autogen_negative)2371 TEST(StaticRuntime, autogen_negative) {
2372 const std::string script = R"IR(
2373 graph(%self: Tensor):
2374 %bias: None = prim::Constant()
2375 %ret = aten::negative(%self)
2376 %cloned = aten::clone(%ret, %bias)
2377 return (%cloned)
2378 )IR";
2379
2380 auto self0 = at::rand({6, 6, 6});
2381 std::vector<IValue> args{self0};
2382 testStaticRuntime(
2383 script,
2384 args,
2385 {},
2386 /*use_allclose=*/false,
2387 /*use_equalnan=*/false,
2388 /*check_resize=*/true);
2389
2390 auto self1 = at::rand({22, 22, 22});
2391 std::vector<IValue> args2{self1};
2392 testStaticRuntime(
2393 script,
2394 args,
2395 args2,
2396 /*use_allclose=*/false,
2397 /*use_equalnan=*/false,
2398 /*check_resize=*/true);
2399 }
2400
TEST(StaticRuntime,autogen_round)2401 TEST(StaticRuntime, autogen_round) {
2402 const std::string script = R"IR(
2403 graph(%self: Tensor):
2404 %bias: None = prim::Constant()
2405 %ret = aten::round(%self)
2406 %cloned = aten::clone(%ret, %bias)
2407 return (%cloned)
2408 )IR";
2409
2410 auto self0 = at::rand({6, 6, 6});
2411 std::vector<IValue> args{self0};
2412 testStaticRuntime(
2413 script,
2414 args,
2415 {},
2416 /*use_allclose=*/false,
2417 /*use_equalnan=*/false,
2418 /*check_resize=*/true);
2419
2420 auto self1 = at::rand({22, 22, 22});
2421 std::vector<IValue> args2{self1};
2422 testStaticRuntime(
2423 script,
2424 args,
2425 args2,
2426 /*use_allclose=*/false,
2427 /*use_equalnan=*/false,
2428 /*check_resize=*/true);
2429 }
2430
TEST(StaticRuntime,autogen_round_decimals)2431 TEST(StaticRuntime, autogen_round_decimals) {
2432 const std::string script = R"IR(
2433 graph(%self: Tensor, %decimals: int):
2434 %bias: None = prim::Constant()
2435 %ret = aten::round(%self, %decimals)
2436 %cloned = aten::clone(%ret, %bias)
2437 return (%cloned)
2438 )IR";
2439
2440 auto self0 = at::rand({6, 6, 6});
2441 auto decimals0 = 1;
2442 std::vector<IValue> args{self0, decimals0};
2443 testStaticRuntime(
2444 script,
2445 args,
2446 {},
2447 /*use_allclose=*/false,
2448 /*use_equalnan=*/false,
2449 /*check_resize=*/true);
2450
2451 auto self1 = at::rand({22, 22, 22});
2452 auto decimals1 = 1;
2453 std::vector<IValue> args2{self1, decimals1};
2454 testStaticRuntime(
2455 script,
2456 args,
2457 args2,
2458 /*use_allclose=*/false,
2459 /*use_equalnan=*/false,
2460 /*check_resize=*/true);
2461 }
2462
TEST(StaticRuntime,autogen_gelu)2463 TEST(StaticRuntime, autogen_gelu) {
2464 const std::string script = R"IR(
2465 graph(%self: Tensor, %approximate: str):
2466 %bias: None = prim::Constant()
2467 %ret = aten::gelu(%self, %approximate)
2468 %cloned = aten::clone(%ret, %bias)
2469 return (%cloned)
2470 )IR";
2471
2472 auto self0 = at::rand({6, 6, 6});
2473 auto approximate0 = "tanh";
2474 std::vector<IValue> args{self0, approximate0};
2475 testStaticRuntime(
2476 script,
2477 args,
2478 {},
2479 /*use_allclose=*/false,
2480 /*use_equalnan=*/false,
2481 /*check_resize=*/true);
2482
2483 auto self1 = at::rand({22, 22, 22});
2484 auto approximate1 = "tanh";
2485 std::vector<IValue> args2{self1, approximate1};
2486 testStaticRuntime(
2487 script,
2488 args,
2489 args2,
2490 /*use_allclose=*/false,
2491 /*use_equalnan=*/false,
2492 /*check_resize=*/true);
2493 }
2494
TEST(StaticRuntime,autogen_gelu_backward)2495 TEST(StaticRuntime, autogen_gelu_backward) {
2496 const std::string script = R"IR(
2497 graph(%grad_output: Tensor, %self: Tensor, %approximate: str):
2498 %bias: None = prim::Constant()
2499 %ret = aten::gelu_backward(%grad_output, %self, %approximate)
2500 %cloned = aten::clone(%ret, %bias)
2501 return (%cloned)
2502 )IR";
2503
2504 auto grad_output0 = at::rand({6, 6, 6});
2505 auto self0 = at::rand({6, 6, 6});
2506 auto approximate0 = "tanh";
2507 std::vector<IValue> args{grad_output0, self0, approximate0};
2508 testStaticRuntime(
2509 script,
2510 args,
2511 {},
2512 /*use_allclose=*/false,
2513 /*use_equalnan=*/false,
2514 /*check_resize=*/true);
2515
2516 auto grad_output1 = at::rand({22, 22, 22});
2517 auto self1 = at::rand({22, 22, 22});
2518 auto approximate1 = "tanh";
2519 std::vector<IValue> args2{grad_output1, self1, approximate1};
2520 testStaticRuntime(
2521 script,
2522 args,
2523 args2,
2524 /*use_allclose=*/false,
2525 /*use_equalnan=*/false,
2526 /*check_resize=*/true);
2527 }
2528
TEST(StaticRuntime,autogen_hardshrink)2529 TEST(StaticRuntime, autogen_hardshrink) {
2530 const std::string script = R"IR(
2531 graph(%self: Tensor, %lambd: int):
2532 %bias: None = prim::Constant()
2533 %ret = aten::hardshrink(%self, %lambd)
2534 %cloned = aten::clone(%ret, %bias)
2535 return (%cloned)
2536 )IR";
2537
2538 auto self0 = at::rand({6, 6, 6});
2539 auto lambd0 = 2;
2540 std::vector<IValue> args{self0, lambd0};
2541 testStaticRuntime(
2542 script,
2543 args,
2544 {},
2545 /*use_allclose=*/false,
2546 /*use_equalnan=*/false,
2547 /*check_resize=*/true);
2548
2549 auto self1 = at::rand({22, 22, 22});
2550 auto lambd1 = 2;
2551 std::vector<IValue> args2{self1, lambd1};
2552 testStaticRuntime(
2553 script,
2554 args,
2555 args2,
2556 /*use_allclose=*/false,
2557 /*use_equalnan=*/false,
2558 /*check_resize=*/true);
2559 }
2560
TEST(StaticRuntime,autogen_hardshrink_backward)2561 TEST(StaticRuntime, autogen_hardshrink_backward) {
2562 const std::string script = R"IR(
2563 graph(%grad_out: Tensor, %self: Tensor, %lambd: int):
2564 %bias: None = prim::Constant()
2565 %ret = aten::hardshrink_backward(%grad_out, %self, %lambd)
2566 %cloned = aten::clone(%ret, %bias)
2567 return (%cloned)
2568 )IR";
2569
2570 auto grad_out0 = at::rand({6, 6, 6});
2571 auto self0 = at::rand({6, 6, 6});
2572 auto lambd0 = 2;
2573 std::vector<IValue> args{grad_out0, self0, lambd0};
2574 testStaticRuntime(
2575 script,
2576 args,
2577 {},
2578 /*use_allclose=*/false,
2579 /*use_equalnan=*/false,
2580 /*check_resize=*/true);
2581
2582 auto grad_out1 = at::rand({22, 22, 22});
2583 auto self1 = at::rand({22, 22, 22});
2584 auto lambd1 = 2;
2585 std::vector<IValue> args2{grad_out1, self1, lambd1};
2586 testStaticRuntime(
2587 script,
2588 args,
2589 args2,
2590 /*use_allclose=*/false,
2591 /*use_equalnan=*/false,
2592 /*check_resize=*/true);
2593 }
2594
TEST(StaticRuntime,autogen_rsqrt)2595 TEST(StaticRuntime, autogen_rsqrt) {
2596 const std::string script = R"IR(
2597 graph(%self: Tensor):
2598 %bias: None = prim::Constant()
2599 %ret = aten::rsqrt(%self)
2600 %cloned = aten::clone(%ret, %bias)
2601 return (%cloned)
2602 )IR";
2603
2604 auto self0 = at::rand({6, 6, 6});
2605 std::vector<IValue> args{self0};
2606 testStaticRuntime(
2607 script,
2608 args,
2609 {},
2610 /*use_allclose=*/false,
2611 /*use_equalnan=*/false,
2612 /*check_resize=*/true);
2613
2614 auto self1 = at::rand({22, 22, 22});
2615 std::vector<IValue> args2{self1};
2616 testStaticRuntime(
2617 script,
2618 args,
2619 args2,
2620 /*use_allclose=*/false,
2621 /*use_equalnan=*/false,
2622 /*check_resize=*/true);
2623 }
2624
TEST(StaticRuntime,autogen_silu)2625 TEST(StaticRuntime, autogen_silu) {
2626 const std::string script = R"IR(
2627 graph(%self: Tensor):
2628 %bias: None = prim::Constant()
2629 %ret = aten::silu(%self)
2630 %cloned = aten::clone(%ret, %bias)
2631 return (%cloned)
2632 )IR";
2633
2634 auto self0 = at::rand({6, 6, 6});
2635 std::vector<IValue> args{self0};
2636 testStaticRuntime(
2637 script,
2638 args,
2639 {},
2640 /*use_allclose=*/false,
2641 /*use_equalnan=*/false,
2642 /*check_resize=*/true);
2643
2644 auto self1 = at::rand({22, 22, 22});
2645 std::vector<IValue> args2{self1};
2646 testStaticRuntime(
2647 script,
2648 args,
2649 args2,
2650 /*use_allclose=*/false,
2651 /*use_equalnan=*/false,
2652 /*check_resize=*/true);
2653 }
2654
TEST(StaticRuntime,autogen_silu_backward)2655 TEST(StaticRuntime, autogen_silu_backward) {
2656 const std::string script = R"IR(
2657 graph(%grad_output: Tensor, %self: Tensor):
2658 %bias: None = prim::Constant()
2659 %ret = aten::silu_backward(%grad_output, %self)
2660 %cloned = aten::clone(%ret, %bias)
2661 return (%cloned)
2662 )IR";
2663
2664 auto grad_output0 = at::rand({6, 6, 6});
2665 auto self0 = at::rand({6, 6, 6});
2666 std::vector<IValue> args{grad_output0, self0};
2667 testStaticRuntime(
2668 script,
2669 args,
2670 {},
2671 /*use_allclose=*/false,
2672 /*use_equalnan=*/false,
2673 /*check_resize=*/true);
2674
2675 auto grad_output1 = at::rand({22, 22, 22});
2676 auto self1 = at::rand({22, 22, 22});
2677 std::vector<IValue> args2{grad_output1, self1};
2678 testStaticRuntime(
2679 script,
2680 args,
2681 args2,
2682 /*use_allclose=*/false,
2683 /*use_equalnan=*/false,
2684 /*check_resize=*/true);
2685 }
2686
TEST(StaticRuntime,autogen_mish)2687 TEST(StaticRuntime, autogen_mish) {
2688 const std::string script = R"IR(
2689 graph(%self: Tensor):
2690 %bias: None = prim::Constant()
2691 %ret = aten::mish(%self)
2692 %cloned = aten::clone(%ret, %bias)
2693 return (%cloned)
2694 )IR";
2695
2696 auto self0 = at::rand({6, 6, 6});
2697 std::vector<IValue> args{self0};
2698 testStaticRuntime(
2699 script,
2700 args,
2701 {},
2702 /*use_allclose=*/false,
2703 /*use_equalnan=*/false,
2704 /*check_resize=*/true);
2705
2706 auto self1 = at::rand({22, 22, 22});
2707 std::vector<IValue> args2{self1};
2708 testStaticRuntime(
2709 script,
2710 args,
2711 args2,
2712 /*use_allclose=*/false,
2713 /*use_equalnan=*/false,
2714 /*check_resize=*/true);
2715 }
2716
TEST(StaticRuntime,autogen_sin)2717 TEST(StaticRuntime, autogen_sin) {
2718 const std::string script = R"IR(
2719 graph(%self: Tensor):
2720 %bias: None = prim::Constant()
2721 %ret = aten::sin(%self)
2722 %cloned = aten::clone(%ret, %bias)
2723 return (%cloned)
2724 )IR";
2725
2726 auto self0 = at::rand({6, 6, 6});
2727 std::vector<IValue> args{self0};
2728 testStaticRuntime(
2729 script,
2730 args,
2731 {},
2732 /*use_allclose=*/false,
2733 /*use_equalnan=*/false,
2734 /*check_resize=*/true);
2735
2736 auto self1 = at::rand({22, 22, 22});
2737 std::vector<IValue> args2{self1};
2738 testStaticRuntime(
2739 script,
2740 args,
2741 args2,
2742 /*use_allclose=*/false,
2743 /*use_equalnan=*/false,
2744 /*check_resize=*/true);
2745 }
2746
TEST(StaticRuntime,autogen_sinc)2747 TEST(StaticRuntime, autogen_sinc) {
2748 const std::string script = R"IR(
2749 graph(%self: Tensor):
2750 %bias: None = prim::Constant()
2751 %ret = aten::sinc(%self)
2752 %cloned = aten::clone(%ret, %bias)
2753 return (%cloned)
2754 )IR";
2755
2756 auto self0 = at::rand({6, 6, 6});
2757 std::vector<IValue> args{self0};
2758 testStaticRuntime(
2759 script,
2760 args,
2761 {},
2762 /*use_allclose=*/false,
2763 /*use_equalnan=*/false,
2764 /*check_resize=*/true);
2765
2766 auto self1 = at::rand({22, 22, 22});
2767 std::vector<IValue> args2{self1};
2768 testStaticRuntime(
2769 script,
2770 args,
2771 args2,
2772 /*use_allclose=*/false,
2773 /*use_equalnan=*/false,
2774 /*check_resize=*/true);
2775 }
2776
TEST(StaticRuntime,autogen_sinh)2777 TEST(StaticRuntime, autogen_sinh) {
2778 const std::string script = R"IR(
2779 graph(%self: Tensor):
2780 %bias: None = prim::Constant()
2781 %ret = aten::sinh(%self)
2782 %cloned = aten::clone(%ret, %bias)
2783 return (%cloned)
2784 )IR";
2785
2786 auto self0 = at::rand({6, 6, 6});
2787 std::vector<IValue> args{self0};
2788 testStaticRuntime(
2789 script,
2790 args,
2791 {},
2792 /*use_allclose=*/false,
2793 /*use_equalnan=*/false,
2794 /*check_resize=*/true);
2795
2796 auto self1 = at::rand({22, 22, 22});
2797 std::vector<IValue> args2{self1};
2798 testStaticRuntime(
2799 script,
2800 args,
2801 args2,
2802 /*use_allclose=*/false,
2803 /*use_equalnan=*/false,
2804 /*check_resize=*/true);
2805 }
2806
TEST(StaticRuntime,autogen__softmax)2807 TEST(StaticRuntime, autogen__softmax) {
2808 const std::string script = R"IR(
2809 graph(%self: Tensor, %dim: int, %half_to_float: bool):
2810 %bias: None = prim::Constant()
2811 %ret = aten::_softmax(%self, %dim, %half_to_float)
2812 %cloned = aten::clone(%ret, %bias)
2813 return (%cloned)
2814 )IR";
2815
2816 auto self0 = at::rand({6, 6, 6});
2817 auto dim0 = 1;
2818 auto half_to_float0 = false;
2819 std::vector<IValue> args{self0, dim0, half_to_float0};
2820 testStaticRuntime(
2821 script,
2822 args,
2823 {},
2824 /*use_allclose=*/false,
2825 /*use_equalnan=*/false,
2826 /*check_resize=*/true);
2827
2828 auto self1 = at::rand({22, 22, 22});
2829 auto dim1 = 1;
2830 auto half_to_float1 = false;
2831 std::vector<IValue> args2{self1, dim1, half_to_float1};
2832 testStaticRuntime(
2833 script,
2834 args,
2835 args2,
2836 /*use_allclose=*/false,
2837 /*use_equalnan=*/false,
2838 /*check_resize=*/true);
2839 }
2840
TEST(StaticRuntime,autogen__softmax_backward_data)2841 TEST(StaticRuntime, autogen__softmax_backward_data) {
2842 const std::string script = R"IR(
2843 graph(%grad_output: Tensor, %output: Tensor, %dim: int, %input_dtype: int):
2844 %bias: None = prim::Constant()
2845 %ret = aten::_softmax_backward_data(%grad_output, %output, %dim, %input_dtype)
2846 %cloned = aten::clone(%ret, %bias)
2847 return (%cloned)
2848 )IR";
2849
2850 auto grad_output0 = at::rand({6, 6, 6});
2851 auto output0 = at::rand({6, 6, 6});
2852 auto dim0 = 1;
2853 auto input_dtype0 = at::ScalarType::Float;
2854 std::vector<IValue> args{grad_output0, output0, dim0, input_dtype0};
2855 testStaticRuntime(
2856 script,
2857 args,
2858 {},
2859 /*use_allclose=*/false,
2860 /*use_equalnan=*/false,
2861 /*check_resize=*/true);
2862
2863 auto grad_output1 = at::rand({22, 22, 22});
2864 auto output1 = at::rand({22, 22, 22});
2865 auto dim1 = 1;
2866 auto input_dtype1 = at::ScalarType::Float;
2867 std::vector<IValue> args2{grad_output1, output1, dim1, input_dtype1};
2868 testStaticRuntime(
2869 script,
2870 args,
2871 args2,
2872 /*use_allclose=*/false,
2873 /*use_equalnan=*/false,
2874 /*check_resize=*/true);
2875 }
2876
TEST(StaticRuntime,autogen_sqrt)2877 TEST(StaticRuntime, autogen_sqrt) {
2878 const std::string script = R"IR(
2879 graph(%self: Tensor):
2880 %bias: None = prim::Constant()
2881 %ret = aten::sqrt(%self)
2882 %cloned = aten::clone(%ret, %bias)
2883 return (%cloned)
2884 )IR";
2885
2886 auto self0 = at::rand({6, 6, 6});
2887 std::vector<IValue> args{self0};
2888 testStaticRuntime(
2889 script,
2890 args,
2891 {},
2892 /*use_allclose=*/false,
2893 /*use_equalnan=*/false,
2894 /*check_resize=*/true);
2895
2896 auto self1 = at::rand({22, 22, 22});
2897 std::vector<IValue> args2{self1};
2898 testStaticRuntime(
2899 script,
2900 args,
2901 args2,
2902 /*use_allclose=*/false,
2903 /*use_equalnan=*/false,
2904 /*check_resize=*/true);
2905 }
2906
TEST(StaticRuntime,autogen_square)2907 TEST(StaticRuntime, autogen_square) {
2908 const std::string script = R"IR(
2909 graph(%self: Tensor):
2910 %bias: None = prim::Constant()
2911 %ret = aten::square(%self)
2912 %cloned = aten::clone(%ret, %bias)
2913 return (%cloned)
2914 )IR";
2915
2916 auto self0 = at::rand({6, 6, 6});
2917 std::vector<IValue> args{self0};
2918 testStaticRuntime(
2919 script,
2920 args,
2921 {},
2922 /*use_allclose=*/false,
2923 /*use_equalnan=*/false,
2924 /*check_resize=*/true);
2925
2926 auto self1 = at::rand({22, 22, 22});
2927 std::vector<IValue> args2{self1};
2928 testStaticRuntime(
2929 script,
2930 args,
2931 args2,
2932 /*use_allclose=*/false,
2933 /*use_equalnan=*/false,
2934 /*check_resize=*/true);
2935 }
2936
TEST(StaticRuntime,autogen_prod)2937 TEST(StaticRuntime, autogen_prod) {
2938 const std::string script = R"IR(
2939 graph(%self: Tensor, %dtype: int?):
2940 %bias: None = prim::Constant()
2941 %ret = aten::prod(%self, %dtype)
2942 %cloned = aten::clone(%ret, %bias)
2943 return (%cloned)
2944 )IR";
2945
2946 auto self0 = at::rand({6, 6, 6});
2947 auto dtype0 = at::ScalarType::Float;
2948 std::vector<IValue> args{self0, dtype0};
2949 testStaticRuntime(
2950 script,
2951 args,
2952 {},
2953 /*use_allclose=*/false,
2954 /*use_equalnan=*/false,
2955 /*check_resize=*/false);
2956
2957 auto self1 = at::rand({22, 22, 22});
2958 auto dtype1 = at::ScalarType::Float;
2959 std::vector<IValue> args2{self1, dtype1};
2960 testStaticRuntime(
2961 script,
2962 args,
2963 args2,
2964 /*use_allclose=*/false,
2965 /*use_equalnan=*/false,
2966 /*check_resize=*/false);
2967 }
2968
TEST(StaticRuntime,autogen_prod_dim_int)2969 TEST(StaticRuntime, autogen_prod_dim_int) {
2970 const std::string script = R"IR(
2971 graph(%self: Tensor, %dim: int, %keepdim: bool, %dtype: int?):
2972 %bias: None = prim::Constant()
2973 %ret = aten::prod(%self, %dim, %keepdim, %dtype)
2974 %cloned = aten::clone(%ret, %bias)
2975 return (%cloned)
2976 )IR";
2977
2978 auto self0 = at::rand({6, 6, 6});
2979 auto dim0 = 1;
2980 auto keepdim0 = false;
2981 auto dtype0 = at::ScalarType::Float;
2982 std::vector<IValue> args{self0, dim0, keepdim0, dtype0};
2983 testStaticRuntime(
2984 script,
2985 args,
2986 {},
2987 /*use_allclose=*/false,
2988 /*use_equalnan=*/false,
2989 /*check_resize=*/true);
2990
2991 auto self1 = at::rand({22, 22, 22});
2992 auto dim1 = 1;
2993 auto keepdim1 = false;
2994 auto dtype1 = at::ScalarType::Float;
2995 std::vector<IValue> args2{self1, dim1, keepdim1, dtype1};
2996 testStaticRuntime(
2997 script,
2998 args,
2999 args2,
3000 /*use_allclose=*/false,
3001 /*use_equalnan=*/false,
3002 /*check_resize=*/true);
3003 }
3004
TEST(StaticRuntime,autogen_tan)3005 TEST(StaticRuntime, autogen_tan) {
3006 const std::string script = R"IR(
3007 graph(%self: Tensor):
3008 %bias: None = prim::Constant()
3009 %ret = aten::tan(%self)
3010 %cloned = aten::clone(%ret, %bias)
3011 return (%cloned)
3012 )IR";
3013
3014 auto self0 = at::rand({6, 6, 6});
3015 std::vector<IValue> args{self0};
3016 testStaticRuntime(
3017 script,
3018 args,
3019 {},
3020 /*use_allclose=*/false,
3021 /*use_equalnan=*/false,
3022 /*check_resize=*/true);
3023
3024 auto self1 = at::rand({22, 22, 22});
3025 std::vector<IValue> args2{self1};
3026 testStaticRuntime(
3027 script,
3028 args,
3029 args2,
3030 /*use_allclose=*/false,
3031 /*use_equalnan=*/false,
3032 /*check_resize=*/true);
3033 }
3034
TEST(StaticRuntime,autogen_threshold)3035 TEST(StaticRuntime, autogen_threshold) {
3036 const std::string script = R"IR(
3037 graph(%self: Tensor, %threshold: int, %value: int):
3038 %bias: None = prim::Constant()
3039 %ret = aten::threshold(%self, %threshold, %value)
3040 %cloned = aten::clone(%ret, %bias)
3041 return (%cloned)
3042 )IR";
3043
3044 auto self0 = at::rand({6, 6, 6});
3045 auto threshold0 = 2;
3046 auto value0 = 2;
3047 std::vector<IValue> args{self0, threshold0, value0};
3048 testStaticRuntime(
3049 script,
3050 args,
3051 {},
3052 /*use_allclose=*/false,
3053 /*use_equalnan=*/false,
3054 /*check_resize=*/true);
3055
3056 auto self1 = at::rand({22, 22, 22});
3057 auto threshold1 = 2;
3058 auto value1 = 2;
3059 std::vector<IValue> args2{self1, threshold1, value1};
3060 testStaticRuntime(
3061 script,
3062 args,
3063 args2,
3064 /*use_allclose=*/false,
3065 /*use_equalnan=*/false,
3066 /*check_resize=*/true);
3067 }
3068
TEST(StaticRuntime,autogen_threshold_backward)3069 TEST(StaticRuntime, autogen_threshold_backward) {
3070 const std::string script = R"IR(
3071 graph(%grad_output: Tensor, %self: Tensor, %threshold: int):
3072 %bias: None = prim::Constant()
3073 %ret = aten::threshold_backward(%grad_output, %self, %threshold)
3074 %cloned = aten::clone(%ret, %bias)
3075 return (%cloned)
3076 )IR";
3077
3078 auto grad_output0 = at::rand({6, 6, 6});
3079 auto self0 = at::rand({6, 6, 6});
3080 auto threshold0 = 2;
3081 std::vector<IValue> args{grad_output0, self0, threshold0};
3082 testStaticRuntime(
3083 script,
3084 args,
3085 {},
3086 /*use_allclose=*/false,
3087 /*use_equalnan=*/false,
3088 /*check_resize=*/true);
3089
3090 auto grad_output1 = at::rand({22, 22, 22});
3091 auto self1 = at::rand({22, 22, 22});
3092 auto threshold1 = 2;
3093 std::vector<IValue> args2{grad_output1, self1, threshold1};
3094 testStaticRuntime(
3095 script,
3096 args,
3097 args2,
3098 /*use_allclose=*/false,
3099 /*use_equalnan=*/false,
3100 /*check_resize=*/true);
3101 }
3102
TEST(StaticRuntime,autogen_trunc)3103 TEST(StaticRuntime, autogen_trunc) {
3104 const std::string script = R"IR(
3105 graph(%self: Tensor):
3106 %bias: None = prim::Constant()
3107 %ret = aten::trunc(%self)
3108 %cloned = aten::clone(%ret, %bias)
3109 return (%cloned)
3110 )IR";
3111
3112 auto self0 = at::rand({6, 6, 6});
3113 std::vector<IValue> args{self0};
3114 testStaticRuntime(
3115 script,
3116 args,
3117 {},
3118 /*use_allclose=*/false,
3119 /*use_equalnan=*/false,
3120 /*check_resize=*/true);
3121
3122 auto self1 = at::rand({22, 22, 22});
3123 std::vector<IValue> args2{self1};
3124 testStaticRuntime(
3125 script,
3126 args,
3127 args2,
3128 /*use_allclose=*/false,
3129 /*use_equalnan=*/false,
3130 /*check_resize=*/true);
3131 }
3132
TEST(StaticRuntime,autogen_fix)3133 TEST(StaticRuntime, autogen_fix) {
3134 const std::string script = R"IR(
3135 graph(%self: Tensor):
3136 %bias: None = prim::Constant()
3137 %ret = aten::fix(%self)
3138 %cloned = aten::clone(%ret, %bias)
3139 return (%cloned)
3140 )IR";
3141
3142 auto self0 = at::rand({6, 6, 6});
3143 std::vector<IValue> args{self0};
3144 testStaticRuntime(
3145 script,
3146 args,
3147 {},
3148 /*use_allclose=*/false,
3149 /*use_equalnan=*/false,
3150 /*check_resize=*/true);
3151
3152 auto self1 = at::rand({22, 22, 22});
3153 std::vector<IValue> args2{self1};
3154 testStaticRuntime(
3155 script,
3156 args,
3157 args2,
3158 /*use_allclose=*/false,
3159 /*use_equalnan=*/false,
3160 /*check_resize=*/true);
3161 }
3162
TEST(StaticRuntime,autogen_nuclear_norm)3163 TEST(StaticRuntime, autogen_nuclear_norm) {
3164 const std::string script = R"IR(
3165 graph(%self: Tensor, %keepdim: bool):
3166 %bias: None = prim::Constant()
3167 %ret = aten::nuclear_norm(%self, %keepdim)
3168 %cloned = aten::clone(%ret, %bias)
3169 return (%cloned)
3170 )IR";
3171
3172 auto self0 = at::rand({8, 8});
3173 auto keepdim0 = false;
3174 std::vector<IValue> args{self0, keepdim0};
3175 testStaticRuntime(
3176 script,
3177 args,
3178 {},
3179 /*use_allclose=*/false,
3180 /*use_equalnan=*/false,
3181 /*check_resize=*/false);
3182
3183 auto self1 = at::rand({32, 32});
3184 auto keepdim1 = false;
3185 std::vector<IValue> args2{self1, keepdim1};
3186 testStaticRuntime(
3187 script,
3188 args,
3189 args2,
3190 /*use_allclose=*/false,
3191 /*use_equalnan=*/false,
3192 /*check_resize=*/false);
3193 }
3194
TEST(StaticRuntime,autogen_subtract_Tensor)3195 TEST(StaticRuntime, autogen_subtract_Tensor) {
3196 const std::string script = R"IR(
3197 graph(%self: Tensor, %other: Tensor, %alpha: int):
3198 %bias: None = prim::Constant()
3199 %ret = aten::subtract(%self, %other, %alpha)
3200 %cloned = aten::clone(%ret, %bias)
3201 return (%cloned)
3202 )IR";
3203
3204 auto self0 = at::rand({6, 6, 6});
3205 auto other0 = at::rand({6, 6, 6});
3206 auto alpha0 = 2;
3207 std::vector<IValue> args{self0, other0, alpha0};
3208 testStaticRuntime(
3209 script,
3210 args,
3211 {},
3212 /*use_allclose=*/false,
3213 /*use_equalnan=*/false,
3214 /*check_resize=*/true);
3215
3216 auto self1 = at::rand({22, 22, 22});
3217 auto other1 = at::rand({22, 22, 22});
3218 auto alpha1 = 2;
3219 std::vector<IValue> args2{self1, other1, alpha1};
3220 testStaticRuntime(
3221 script,
3222 args,
3223 args2,
3224 /*use_allclose=*/false,
3225 /*use_equalnan=*/false,
3226 /*check_resize=*/true);
3227 }
3228
TEST(StaticRuntime,autogen_heaviside)3229 TEST(StaticRuntime, autogen_heaviside) {
3230 const std::string script = R"IR(
3231 graph(%self: Tensor, %values: Tensor):
3232 %bias: None = prim::Constant()
3233 %ret = aten::heaviside(%self, %values)
3234 %cloned = aten::clone(%ret, %bias)
3235 return (%cloned)
3236 )IR";
3237
3238 auto self0 = at::rand({6, 6, 6});
3239 auto values0 = at::rand({6, 6, 6});
3240 std::vector<IValue> args{self0, values0};
3241 testStaticRuntime(
3242 script,
3243 args,
3244 {},
3245 /*use_allclose=*/false,
3246 /*use_equalnan=*/false,
3247 /*check_resize=*/true);
3248
3249 auto self1 = at::rand({22, 22, 22});
3250 auto values1 = at::rand({22, 22, 22});
3251 std::vector<IValue> args2{self1, values1};
3252 testStaticRuntime(
3253 script,
3254 args,
3255 args2,
3256 /*use_allclose=*/false,
3257 /*use_equalnan=*/false,
3258 /*check_resize=*/true);
3259 }
3260
TEST(StaticRuntime,autogen__addmm_activation)3261 TEST(StaticRuntime, autogen__addmm_activation) {
3262 const std::string script = R"IR(
3263 graph(%self: Tensor, %mat1: Tensor, %mat2: Tensor, %beta: int, %alpha: int, %use_gelu: bool):
3264 %bias: None = prim::Constant()
3265 %ret = aten::_addmm_activation(%self, %mat1, %mat2, %beta, %alpha, %use_gelu)
3266 %cloned = aten::clone(%ret, %bias)
3267 return (%cloned)
3268 )IR";
3269
3270 auto self0 = at::rand({8, 8});
3271 auto mat10 = at::rand({8, 8});
3272 auto mat20 = at::rand({8, 8});
3273 auto beta0 = 2;
3274 auto alpha0 = 2;
3275 auto use_gelu0 = false;
3276 std::vector<IValue> args{self0, mat10, mat20, beta0, alpha0, use_gelu0};
3277 testStaticRuntime(
3278 script,
3279 args,
3280 {},
3281 /*use_allclose=*/false,
3282 /*use_equalnan=*/false,
3283 /*check_resize=*/true);
3284
3285 auto self1 = at::rand({32, 32});
3286 auto mat11 = at::rand({32, 32});
3287 auto mat21 = at::rand({32, 32});
3288 auto beta1 = 2;
3289 auto alpha1 = 2;
3290 auto use_gelu1 = false;
3291 std::vector<IValue> args2{self1, mat11, mat21, beta1, alpha1, use_gelu1};
3292 testStaticRuntime(
3293 script,
3294 args,
3295 args2,
3296 /*use_allclose=*/false,
3297 /*use_equalnan=*/false,
3298 /*check_resize=*/true);
3299 }
3300
TEST(StaticRuntime,autogen_index_add)3301 TEST(StaticRuntime, autogen_index_add) {
3302 const std::string script = R"IR(
3303 graph(%self: Tensor, %dim: int, %index: Tensor, %source: Tensor, %alpha: int):
3304 %bias: None = prim::Constant()
3305 %ret = aten::index_add(%self, %dim, %index, %source, %alpha)
3306 %cloned = aten::clone(%ret, %bias)
3307 return (%cloned)
3308 )IR";
3309
3310 auto self0 = at::rand({2});
3311 auto dim0 = 0;
3312 auto index0 = at::randint(0, 1, {2}, at::kInt);
3313 auto source0 = at::rand({2});
3314 auto alpha0 = 2;
3315 std::vector<IValue> args{self0, dim0, index0, source0, alpha0};
3316 testStaticRuntime(
3317 script,
3318 args,
3319 {},
3320 /*use_allclose=*/false,
3321 /*use_equalnan=*/false,
3322 /*check_resize=*/false);
3323
3324 auto self1 = at::rand({16});
3325 auto dim1 = 0;
3326 auto index1 = at::randint(0, 10, {16}, at::kInt);
3327 auto source1 = at::rand({16});
3328 auto alpha1 = 2;
3329 std::vector<IValue> args2{self1, dim1, index1, source1, alpha1};
3330 testStaticRuntime(
3331 script,
3332 args,
3333 args2,
3334 /*use_allclose=*/false,
3335 /*use_equalnan=*/false,
3336 /*check_resize=*/false);
3337 }
3338
TEST(StaticRuntime,autogen_scatter_src)3339 TEST(StaticRuntime, autogen_scatter_src) {
3340 const std::string script = R"IR(
3341 graph(%self: Tensor, %dim: int, %index: Tensor, %src: Tensor):
3342 %bias: None = prim::Constant()
3343 %ret = aten::scatter(%self, %dim, %index, %src)
3344 %cloned = aten::clone(%ret, %bias)
3345 return (%cloned)
3346 )IR";
3347
3348 auto self0 = at::randint(1, 100, {2, 2, 2}, torch::kInt64);
3349 auto dim0 = 1;
3350 auto index0 = at::randint(0, 1, {2, 2, 2}, torch::kInt64);
3351 auto src0 = at::randint(1, 100, {2, 2, 2}, torch::kInt64);
3352 std::vector<IValue> args{self0, dim0, index0, src0};
3353 testStaticRuntime(
3354 script,
3355 args,
3356 {},
3357 /*use_allclose=*/false,
3358 /*use_equalnan=*/false,
3359 /*check_resize=*/true);
3360
3361 auto self1 = at::randint(1, 100, {5, 5, 5}, torch::kInt64);
3362 auto dim1 = 1;
3363 auto index1 = at::randint(0, 1, {5, 5, 5}, torch::kInt64);
3364 auto src1 = at::randint(1, 100, {5, 5, 5}, torch::kInt64);
3365 std::vector<IValue> args2{self1, dim1, index1, src1};
3366 testStaticRuntime(
3367 script,
3368 args,
3369 args2,
3370 /*use_allclose=*/false,
3371 /*use_equalnan=*/false,
3372 /*check_resize=*/true);
3373 }
3374
TEST(StaticRuntime,autogen_scatter_value)3375 TEST(StaticRuntime, autogen_scatter_value) {
3376 const std::string script = R"IR(
3377 graph(%self: Tensor, %dim: int, %index: Tensor, %value: int):
3378 %bias: None = prim::Constant()
3379 %ret = aten::scatter(%self, %dim, %index, %value)
3380 %cloned = aten::clone(%ret, %bias)
3381 return (%cloned)
3382 )IR";
3383
3384 auto self0 = at::randint(1, 100, {2, 2, 2}, torch::kInt64);
3385 auto dim0 = 1;
3386 auto index0 = at::randint(0, 1, {2, 2, 2}, torch::kInt64);
3387 auto value0 = 2;
3388 auto src0 = at::randint(1, 100, {2, 2, 2}, torch::kInt64);
3389 std::vector<IValue> args{self0, dim0, index0, value0};
3390 testStaticRuntime(
3391 script,
3392 args,
3393 {},
3394 /*use_allclose=*/false,
3395 /*use_equalnan=*/false,
3396 /*check_resize=*/true);
3397
3398 auto self1 = at::randint(1, 100, {5, 5, 5}, torch::kInt64);
3399 auto dim1 = 1;
3400 auto index1 = at::randint(0, 1, {5, 5, 5}, torch::kInt64);
3401 auto value1 = 2;
3402 auto src1 = at::randint(1, 100, {5, 5, 5}, torch::kInt64);
3403 std::vector<IValue> args2{self1, dim1, index1, value1};
3404 testStaticRuntime(
3405 script,
3406 args,
3407 args2,
3408 /*use_allclose=*/false,
3409 /*use_equalnan=*/false,
3410 /*check_resize=*/true);
3411 }
3412
TEST(StaticRuntime,autogen_scatter_reduce)3413 TEST(StaticRuntime, autogen_scatter_reduce) {
3414 const std::string script = R"IR(
3415 graph(%self: Tensor, %dim: int, %index: Tensor, %src: Tensor, %reduce: str):
3416 %bias: None = prim::Constant()
3417 %ret = aten::scatter(%self, %dim, %index, %src, %reduce)
3418 %cloned = aten::clone(%ret, %bias)
3419 return (%cloned)
3420 )IR";
3421
3422 auto self0 = at::randint(1, 100, {2, 2, 2}, torch::kInt64);
3423 auto dim0 = 1;
3424 auto index0 = at::randint(0, 1, {2, 2, 2}, torch::kInt64);
3425 auto src0 = at::randint(1, 100, {2, 2, 2}, torch::kInt64);
3426 auto reduce0 = "add";
3427 std::vector<IValue> args{self0, dim0, index0, src0, reduce0};
3428 testStaticRuntime(
3429 script,
3430 args,
3431 {},
3432 /*use_allclose=*/false,
3433 /*use_equalnan=*/false,
3434 /*check_resize=*/true);
3435
3436 auto self1 = at::randint(1, 100, {5, 5, 5}, torch::kInt64);
3437 auto dim1 = 1;
3438 auto index1 = at::randint(0, 1, {5, 5, 5}, torch::kInt64);
3439 auto src1 = at::randint(1, 100, {5, 5, 5}, torch::kInt64);
3440 auto reduce1 = "add";
3441 std::vector<IValue> args2{self1, dim1, index1, src1, reduce1};
3442 testStaticRuntime(
3443 script,
3444 args,
3445 args2,
3446 /*use_allclose=*/false,
3447 /*use_equalnan=*/false,
3448 /*check_resize=*/true);
3449 }
3450
TEST(StaticRuntime,autogen_scatter_value_reduce)3451 TEST(StaticRuntime, autogen_scatter_value_reduce) {
3452 const std::string script = R"IR(
3453 graph(%self: Tensor, %dim: int, %index: Tensor, %value: int, %reduce: str):
3454 %bias: None = prim::Constant()
3455 %ret = aten::scatter(%self, %dim, %index, %value, %reduce)
3456 %cloned = aten::clone(%ret, %bias)
3457 return (%cloned)
3458 )IR";
3459
3460 auto self0 = at::randint(1, 100, {2, 2, 2}, torch::kInt64);
3461 auto dim0 = 1;
3462 auto index0 = at::randint(0, 1, {2, 2, 2}, torch::kInt64);
3463 auto value0 = 2;
3464 auto reduce0 = "add";
3465 auto src0 = at::randint(1, 100, {2, 2, 2}, torch::kInt64);
3466 std::vector<IValue> args{self0, dim0, index0, value0, reduce0};
3467 testStaticRuntime(
3468 script,
3469 args,
3470 {},
3471 /*use_allclose=*/false,
3472 /*use_equalnan=*/false,
3473 /*check_resize=*/true);
3474
3475 auto self1 = at::randint(1, 100, {5, 5, 5}, torch::kInt64);
3476 auto dim1 = 1;
3477 auto index1 = at::randint(0, 1, {5, 5, 5}, torch::kInt64);
3478 auto value1 = 2;
3479 auto reduce1 = "add";
3480 auto src1 = at::randint(1, 100, {5, 5, 5}, torch::kInt64);
3481 std::vector<IValue> args2{self1, dim1, index1, value1, reduce1};
3482 testStaticRuntime(
3483 script,
3484 args,
3485 args2,
3486 /*use_allclose=*/false,
3487 /*use_equalnan=*/false,
3488 /*check_resize=*/true);
3489 }
3490
TEST(StaticRuntime,autogen_scatter_add)3491 TEST(StaticRuntime, autogen_scatter_add) {
3492 const std::string script = R"IR(
3493 graph(%self: Tensor, %dim: int, %index: Tensor, %src: Tensor):
3494 %bias: None = prim::Constant()
3495 %ret = aten::scatter_add(%self, %dim, %index, %src)
3496 %cloned = aten::clone(%ret, %bias)
3497 return (%cloned)
3498 )IR";
3499
3500 auto self0 = at::randint(1, 100, {2, 2, 2}, torch::kInt64);
3501 auto dim0 = 1;
3502 auto index0 = at::randint(0, 1, {2, 2, 2}, torch::kInt64);
3503 auto src0 = at::randint(1, 100, {2, 2, 2}, torch::kInt64);
3504 std::vector<IValue> args{self0, dim0, index0, src0};
3505 testStaticRuntime(
3506 script,
3507 args,
3508 {},
3509 /*use_allclose=*/false,
3510 /*use_equalnan=*/false,
3511 /*check_resize=*/true);
3512
3513 auto self1 = at::randint(1, 100, {5, 5, 5}, torch::kInt64);
3514 auto dim1 = 1;
3515 auto index1 = at::randint(0, 1, {5, 5, 5}, torch::kInt64);
3516 auto src1 = at::randint(1, 100, {5, 5, 5}, torch::kInt64);
3517 std::vector<IValue> args2{self1, dim1, index1, src1};
3518 testStaticRuntime(
3519 script,
3520 args,
3521 args2,
3522 /*use_allclose=*/false,
3523 /*use_equalnan=*/false,
3524 /*check_resize=*/true);
3525 }
3526
TEST(StaticRuntime,autogen_scatter_reduce_two)3527 TEST(StaticRuntime, autogen_scatter_reduce_two) {
3528 const std::string script = R"IR(
3529 graph(%self: Tensor, %dim: int, %index: Tensor, %src: Tensor, %reduce: str, %include_self: bool):
3530 %bias: None = prim::Constant()
3531 %ret = aten::scatter_reduce(%self, %dim, %index, %src, %reduce, %include_self)
3532 %cloned = aten::clone(%ret, %bias)
3533 return (%cloned)
3534 )IR";
3535
3536 auto self0 = at::rand({6, 6, 6});
3537 auto dim0 = 1;
3538 auto index0 = at::randint(6, {6, 6, 6}, torch::kInt64);
3539 auto src0 = at::rand({6, 6, 6});
3540 auto reduce0 = "mean";
3541 auto include_self0 = false;
3542 std::vector<IValue> args{self0, dim0, index0, src0, reduce0, include_self0};
3543 testStaticRuntime(
3544 script,
3545 args,
3546 {},
3547 /*use_allclose=*/false,
3548 /*use_equalnan=*/false,
3549 /*check_resize=*/true);
3550
3551 auto self1 = at::rand({22, 22, 22});
3552 auto dim1 = 1;
3553 auto index1 = at::randint(22, {22, 22, 22}, torch::kInt64);
3554 auto src1 = at::rand({22, 22, 22});
3555 auto reduce1 = "mean";
3556 auto include_self1 = false;
3557 std::vector<IValue> args2{self1, dim1, index1, src1, reduce1, include_self1};
3558 testStaticRuntime(
3559 script,
3560 args,
3561 args2,
3562 /*use_allclose=*/false,
3563 /*use_equalnan=*/false,
3564 /*check_resize=*/true);
3565 }
3566
TEST(StaticRuntime,autogen_eq_Scalar)3567 TEST(StaticRuntime, autogen_eq_Scalar) {
3568 const std::string script = R"IR(
3569 graph(%self: Tensor, %other: int):
3570 %bias: None = prim::Constant()
3571 %ret = aten::eq(%self, %other)
3572 %cloned = aten::clone(%ret, %bias)
3573 return (%cloned)
3574 )IR";
3575
3576 auto self0 = at::rand({6, 6, 6});
3577 auto other0 = 2;
3578 std::vector<IValue> args{self0, other0};
3579 testStaticRuntime(
3580 script,
3581 args,
3582 {},
3583 /*use_allclose=*/false,
3584 /*use_equalnan=*/false,
3585 /*check_resize=*/true);
3586
3587 auto self1 = at::rand({22, 22, 22});
3588 auto other1 = 2;
3589 std::vector<IValue> args2{self1, other1};
3590 testStaticRuntime(
3591 script,
3592 args,
3593 args2,
3594 /*use_allclose=*/false,
3595 /*use_equalnan=*/false,
3596 /*check_resize=*/true);
3597 }
3598
TEST(StaticRuntime,autogen_eq_Tensor)3599 TEST(StaticRuntime, autogen_eq_Tensor) {
3600 const std::string script = R"IR(
3601 graph(%self: Tensor, %other: Tensor):
3602 %bias: None = prim::Constant()
3603 %ret = aten::eq(%self, %other)
3604 %cloned = aten::clone(%ret, %bias)
3605 return (%cloned)
3606 )IR";
3607
3608 auto self0 = at::rand({6, 6, 6});
3609 auto other0 = at::rand({6, 6, 6});
3610 std::vector<IValue> args{self0, other0};
3611 testStaticRuntime(
3612 script,
3613 args,
3614 {},
3615 /*use_allclose=*/false,
3616 /*use_equalnan=*/false,
3617 /*check_resize=*/true);
3618
3619 auto self1 = at::rand({22, 22, 22});
3620 auto other1 = at::rand({22, 22, 22});
3621 std::vector<IValue> args2{self1, other1};
3622 testStaticRuntime(
3623 script,
3624 args,
3625 args2,
3626 /*use_allclose=*/false,
3627 /*use_equalnan=*/false,
3628 /*check_resize=*/true);
3629 }
3630
TEST(StaticRuntime,autogen_bitwise_and_Tensor)3631 TEST(StaticRuntime, autogen_bitwise_and_Tensor) {
3632 const std::string script = R"IR(
3633 graph(%self: Tensor, %other: Tensor):
3634 %bias: None = prim::Constant()
3635 %ret = aten::bitwise_and(%self, %other)
3636 %cloned = aten::clone(%ret, %bias)
3637 return (%cloned)
3638 )IR";
3639
3640 auto self0 = at::randint(1, 100, {6, 6, 6}, at::kInt);
3641 auto other0 = at::randint(1, 100, {6, 6, 6}, at::kInt);
3642 std::vector<IValue> args{self0, other0};
3643 testStaticRuntime(
3644 script,
3645 args,
3646 {},
3647 /*use_allclose=*/false,
3648 /*use_equalnan=*/false,
3649 /*check_resize=*/true);
3650
3651 auto self1 = at::randint(1, 100, {22, 22, 22}, at::kInt);
3652 auto other1 = at::randint(1, 100, {22, 22, 22}, at::kInt);
3653 std::vector<IValue> args2{self1, other1};
3654 testStaticRuntime(
3655 script,
3656 args,
3657 args2,
3658 /*use_allclose=*/false,
3659 /*use_equalnan=*/false,
3660 /*check_resize=*/true);
3661 }
3662
TEST(StaticRuntime,autogen_bitwise_or_Tensor)3663 TEST(StaticRuntime, autogen_bitwise_or_Tensor) {
3664 const std::string script = R"IR(
3665 graph(%self: Tensor, %other: Tensor):
3666 %bias: None = prim::Constant()
3667 %ret = aten::bitwise_or(%self, %other)
3668 %cloned = aten::clone(%ret, %bias)
3669 return (%cloned)
3670 )IR";
3671
3672 auto self0 = at::randint(1, 100, {6, 6, 6}, at::kInt);
3673 auto other0 = at::randint(1, 100, {6, 6, 6}, at::kInt);
3674 std::vector<IValue> args{self0, other0};
3675 testStaticRuntime(
3676 script,
3677 args,
3678 {},
3679 /*use_allclose=*/false,
3680 /*use_equalnan=*/false,
3681 /*check_resize=*/true);
3682
3683 auto self1 = at::randint(1, 100, {22, 22, 22}, at::kInt);
3684 auto other1 = at::randint(1, 100, {22, 22, 22}, at::kInt);
3685 std::vector<IValue> args2{self1, other1};
3686 testStaticRuntime(
3687 script,
3688 args,
3689 args2,
3690 /*use_allclose=*/false,
3691 /*use_equalnan=*/false,
3692 /*check_resize=*/true);
3693 }
3694
TEST(StaticRuntime,autogen_bitwise_xor_Tensor)3695 TEST(StaticRuntime, autogen_bitwise_xor_Tensor) {
3696 const std::string script = R"IR(
3697 graph(%self: Tensor, %other: Tensor):
3698 %bias: None = prim::Constant()
3699 %ret = aten::bitwise_xor(%self, %other)
3700 %cloned = aten::clone(%ret, %bias)
3701 return (%cloned)
3702 )IR";
3703
3704 auto self0 = at::randint(1, 100, {6, 6, 6}, at::kInt);
3705 auto other0 = at::randint(1, 100, {6, 6, 6}, at::kInt);
3706 std::vector<IValue> args{self0, other0};
3707 testStaticRuntime(
3708 script,
3709 args,
3710 {},
3711 /*use_allclose=*/false,
3712 /*use_equalnan=*/false,
3713 /*check_resize=*/true);
3714
3715 auto self1 = at::randint(1, 100, {22, 22, 22}, at::kInt);
3716 auto other1 = at::randint(1, 100, {22, 22, 22}, at::kInt);
3717 std::vector<IValue> args2{self1, other1};
3718 testStaticRuntime(
3719 script,
3720 args,
3721 args2,
3722 /*use_allclose=*/false,
3723 /*use_equalnan=*/false,
3724 /*check_resize=*/true);
3725 }
3726
TEST(StaticRuntime,autogen_bitwise_left_shift_Tensor)3727 TEST(StaticRuntime, autogen_bitwise_left_shift_Tensor) {
3728 const std::string script = R"IR(
3729 graph(%self: Tensor, %other: Tensor):
3730 %bias: None = prim::Constant()
3731 %ret = aten::bitwise_left_shift(%self, %other)
3732 %cloned = aten::clone(%ret, %bias)
3733 return (%cloned)
3734 )IR";
3735
3736 auto self0 = at::randint(1, 1 << 4, {6, 6, 6}, at::kInt);
3737 auto other0 = at::randint(1, 26, {6, 6, 6}, at::kInt);
3738 std::vector<IValue> args{self0, other0};
3739 testStaticRuntime(
3740 script,
3741 args,
3742 {},
3743 /*use_allclose=*/false,
3744 /*use_equalnan=*/false,
3745 /*check_resize=*/true);
3746
3747 auto self1 = at::randint(1, 1 << 4, {22, 22, 22}, at::kInt);
3748 auto other1 = at::randint(1, 26, {22, 22, 22}, at::kInt);
3749 std::vector<IValue> args2{self1, other1};
3750 testStaticRuntime(
3751 script,
3752 args,
3753 args2,
3754 /*use_allclose=*/false,
3755 /*use_equalnan=*/false,
3756 /*check_resize=*/true);
3757 }
3758
TEST(StaticRuntime,autogen_bitwise_right_shift_Tensor)3759 TEST(StaticRuntime, autogen_bitwise_right_shift_Tensor) {
3760 const std::string script = R"IR(
3761 graph(%self: Tensor, %other: Tensor):
3762 %bias: None = prim::Constant()
3763 %ret = aten::bitwise_right_shift(%self, %other)
3764 %cloned = aten::clone(%ret, %bias)
3765 return (%cloned)
3766 )IR";
3767
3768 auto self0 = at::randint(1 << 21, 1 << 30, {6, 6, 6}, at::kInt);
3769 auto other0 = at::randint(1, 22, {6, 6, 6}, at::kInt);
3770 std::vector<IValue> args{self0, other0};
3771 testStaticRuntime(
3772 script,
3773 args,
3774 {},
3775 /*use_allclose=*/false,
3776 /*use_equalnan=*/false,
3777 /*check_resize=*/true);
3778
3779 auto self1 = at::randint(1 << 21, 1 << 30, {22, 22, 22}, at::kInt);
3780 auto other1 = at::randint(1, 22, {22, 22, 22}, at::kInt);
3781 std::vector<IValue> args2{self1, other1};
3782 testStaticRuntime(
3783 script,
3784 args,
3785 args2,
3786 /*use_allclose=*/false,
3787 /*use_equalnan=*/false,
3788 /*check_resize=*/true);
3789 }
3790
TEST(StaticRuntime,autogen_tril)3791 TEST(StaticRuntime, autogen_tril) {
3792 const std::string script = R"IR(
3793 graph(%self: Tensor, %diagonal: int):
3794 %bias: None = prim::Constant()
3795 %ret = aten::tril(%self, %diagonal)
3796 %cloned = aten::clone(%ret, %bias)
3797 return (%cloned)
3798 )IR";
3799
3800 auto self0 = at::rand({6, 6, 6});
3801 auto diagonal0 = 1;
3802 std::vector<IValue> args{self0, diagonal0};
3803 testStaticRuntime(
3804 script,
3805 args,
3806 {},
3807 /*use_allclose=*/false,
3808 /*use_equalnan=*/false,
3809 /*check_resize=*/true);
3810
3811 auto self1 = at::rand({22, 22, 22});
3812 auto diagonal1 = 1;
3813 std::vector<IValue> args2{self1, diagonal1};
3814 testStaticRuntime(
3815 script,
3816 args,
3817 args2,
3818 /*use_allclose=*/false,
3819 /*use_equalnan=*/false,
3820 /*check_resize=*/true);
3821 }
3822
TEST(StaticRuntime,autogen_triu)3823 TEST(StaticRuntime, autogen_triu) {
3824 const std::string script = R"IR(
3825 graph(%self: Tensor, %diagonal: int):
3826 %bias: None = prim::Constant()
3827 %ret = aten::triu(%self, %diagonal)
3828 %cloned = aten::clone(%ret, %bias)
3829 return (%cloned)
3830 )IR";
3831
3832 auto self0 = at::rand({6, 6, 6});
3833 auto diagonal0 = 1;
3834 std::vector<IValue> args{self0, diagonal0};
3835 testStaticRuntime(
3836 script,
3837 args,
3838 {},
3839 /*use_allclose=*/false,
3840 /*use_equalnan=*/false,
3841 /*check_resize=*/true);
3842
3843 auto self1 = at::rand({22, 22, 22});
3844 auto diagonal1 = 1;
3845 std::vector<IValue> args2{self1, diagonal1};
3846 testStaticRuntime(
3847 script,
3848 args,
3849 args2,
3850 /*use_allclose=*/false,
3851 /*use_equalnan=*/false,
3852 /*check_resize=*/true);
3853 }
3854
TEST(StaticRuntime,autogen_digamma)3855 TEST(StaticRuntime, autogen_digamma) {
3856 const std::string script = R"IR(
3857 graph(%self: Tensor):
3858 %bias: None = prim::Constant()
3859 %ret = aten::digamma(%self)
3860 %cloned = aten::clone(%ret, %bias)
3861 return (%cloned)
3862 )IR";
3863
3864 auto self0 = at::rand({6, 6, 6});
3865 std::vector<IValue> args{self0};
3866 testStaticRuntime(
3867 script,
3868 args,
3869 {},
3870 /*use_allclose=*/false,
3871 /*use_equalnan=*/false,
3872 /*check_resize=*/true);
3873
3874 auto self1 = at::rand({22, 22, 22});
3875 std::vector<IValue> args2{self1};
3876 testStaticRuntime(
3877 script,
3878 args,
3879 args2,
3880 /*use_allclose=*/false,
3881 /*use_equalnan=*/false,
3882 /*check_resize=*/true);
3883 }
3884
TEST(StaticRuntime,autogen_lerp_Scalar)3885 TEST(StaticRuntime, autogen_lerp_Scalar) {
3886 const std::string script = R"IR(
3887 graph(%self: Tensor, %end: Tensor, %weight: int):
3888 %bias: None = prim::Constant()
3889 %ret = aten::lerp(%self, %end, %weight)
3890 %cloned = aten::clone(%ret, %bias)
3891 return (%cloned)
3892 )IR";
3893
3894 auto self0 = at::rand({6, 6, 6});
3895 auto end0 = at::rand({6, 6, 6});
3896 auto weight0 = 2;
3897 std::vector<IValue> args{self0, end0, weight0};
3898 testStaticRuntime(
3899 script,
3900 args,
3901 {},
3902 /*use_allclose=*/false,
3903 /*use_equalnan=*/false,
3904 /*check_resize=*/true);
3905
3906 auto self1 = at::rand({22, 22, 22});
3907 auto end1 = at::rand({22, 22, 22});
3908 auto weight1 = 2;
3909 std::vector<IValue> args2{self1, end1, weight1};
3910 testStaticRuntime(
3911 script,
3912 args,
3913 args2,
3914 /*use_allclose=*/false,
3915 /*use_equalnan=*/false,
3916 /*check_resize=*/true);
3917 }
3918
TEST(StaticRuntime,autogen_lerp_Tensor)3919 TEST(StaticRuntime, autogen_lerp_Tensor) {
3920 const std::string script = R"IR(
3921 graph(%self: Tensor, %end: Tensor, %weight: Tensor):
3922 %bias: None = prim::Constant()
3923 %ret = aten::lerp(%self, %end, %weight)
3924 %cloned = aten::clone(%ret, %bias)
3925 return (%cloned)
3926 )IR";
3927
3928 auto self0 = at::rand({6, 6, 6});
3929 auto end0 = at::rand({6, 6, 6});
3930 auto weight0 = at::rand({6, 6, 6});
3931 std::vector<IValue> args{self0, end0, weight0};
3932 testStaticRuntime(
3933 script,
3934 args,
3935 {},
3936 /*use_allclose=*/false,
3937 /*use_equalnan=*/false,
3938 /*check_resize=*/true);
3939
3940 auto self1 = at::rand({22, 22, 22});
3941 auto end1 = at::rand({22, 22, 22});
3942 auto weight1 = at::rand({22, 22, 22});
3943 std::vector<IValue> args2{self1, end1, weight1};
3944 testStaticRuntime(
3945 script,
3946 args,
3947 args2,
3948 /*use_allclose=*/false,
3949 /*use_equalnan=*/false,
3950 /*check_resize=*/true);
3951 }
3952
TEST(StaticRuntime,autogen_addbmm)3953 TEST(StaticRuntime, autogen_addbmm) {
3954 const std::string script = R"IR(
3955 graph(%self: Tensor, %batch1: Tensor, %batch2: Tensor, %beta: int, %alpha: int):
3956 %bias: None = prim::Constant()
3957 %ret = aten::addbmm(%self, %batch1, %batch2, %beta, %alpha)
3958 %cloned = aten::clone(%ret, %bias)
3959 return (%cloned)
3960 )IR";
3961
3962 auto self0 = at::rand({6, 6});
3963 auto batch10 = at::rand({6, 6, 6});
3964 auto batch20 = at::rand({6, 6, 6});
3965 auto beta0 = 2;
3966 auto alpha0 = 2;
3967 std::vector<IValue> args{self0, batch10, batch20, beta0, alpha0};
3968 testStaticRuntime(
3969 script,
3970 args,
3971 {},
3972 /*use_allclose=*/false,
3973 /*use_equalnan=*/false,
3974 /*check_resize=*/true);
3975
3976 auto self1 = at::rand({22, 22});
3977 auto batch11 = at::rand({22, 22, 22});
3978 auto batch21 = at::rand({22, 22, 22});
3979 auto beta1 = 2;
3980 auto alpha1 = 2;
3981 std::vector<IValue> args2{self1, batch11, batch21, beta1, alpha1};
3982 testStaticRuntime(
3983 script,
3984 args,
3985 args2,
3986 /*use_allclose=*/false,
3987 /*use_equalnan=*/false,
3988 /*check_resize=*/true);
3989 }
3990
TEST(StaticRuntime,autogen_diag)3991 TEST(StaticRuntime, autogen_diag) {
3992 const std::string script = R"IR(
3993 graph(%self: Tensor, %diagonal: int):
3994 %bias: None = prim::Constant()
3995 %ret = aten::diag(%self, %diagonal)
3996 %cloned = aten::clone(%ret, %bias)
3997 return (%cloned)
3998 )IR";
3999
4000 auto self0 = at::rand({8, 8});
4001 auto diagonal0 = 1;
4002 std::vector<IValue> args{self0, diagonal0};
4003 testStaticRuntime(
4004 script,
4005 args,
4006 {},
4007 /*use_allclose=*/false,
4008 /*use_equalnan=*/false,
4009 /*check_resize=*/true);
4010
4011 auto self1 = at::rand({32, 32});
4012 auto diagonal1 = 1;
4013 std::vector<IValue> args2{self1, diagonal1};
4014 testStaticRuntime(
4015 script,
4016 args,
4017 args2,
4018 /*use_allclose=*/false,
4019 /*use_equalnan=*/false,
4020 /*check_resize=*/true);
4021 }
4022
TEST(StaticRuntime,autogen_cross)4023 TEST(StaticRuntime, autogen_cross) {
4024 const std::string script = R"IR(
4025 graph(%self: Tensor, %other: Tensor, %dim: int?):
4026 %bias: None = prim::Constant()
4027 %ret = aten::cross(%self, %other, %dim)
4028 %cloned = aten::clone(%ret, %bias)
4029 return (%cloned)
4030 )IR";
4031
4032 auto self0 = at::rand({3, 3, 3});
4033 auto other0 = at::rand({3, 3, 3});
4034 auto dim0 = 1;
4035 std::vector<IValue> args{self0, other0, dim0};
4036 testStaticRuntime(
4037 script,
4038 args,
4039 {},
4040 /*use_allclose=*/false,
4041 /*use_equalnan=*/false,
4042 /*check_resize=*/true);
4043
4044 auto self1 = at::rand({22, 3, 22});
4045 auto other1 = at::rand({22, 3, 22});
4046 auto dim1 = 1;
4047 std::vector<IValue> args2{self1, other1, dim1};
4048 testStaticRuntime(
4049 script,
4050 args,
4051 args2,
4052 /*use_allclose=*/false,
4053 /*use_equalnan=*/false,
4054 /*check_resize=*/true);
4055 }
4056
TEST(StaticRuntime,autogen_ne_Scalar)4057 TEST(StaticRuntime, autogen_ne_Scalar) {
4058 const std::string script = R"IR(
4059 graph(%self: Tensor, %other: int):
4060 %bias: None = prim::Constant()
4061 %ret = aten::ne(%self, %other)
4062 %cloned = aten::clone(%ret, %bias)
4063 return (%cloned)
4064 )IR";
4065
4066 auto self0 = at::rand({6, 6, 6});
4067 auto other0 = 2;
4068 std::vector<IValue> args{self0, other0};
4069 testStaticRuntime(
4070 script,
4071 args,
4072 {},
4073 /*use_allclose=*/false,
4074 /*use_equalnan=*/false,
4075 /*check_resize=*/true);
4076
4077 auto self1 = at::rand({22, 22, 22});
4078 auto other1 = 2;
4079 std::vector<IValue> args2{self1, other1};
4080 testStaticRuntime(
4081 script,
4082 args,
4083 args2,
4084 /*use_allclose=*/false,
4085 /*use_equalnan=*/false,
4086 /*check_resize=*/true);
4087 }
4088
TEST(StaticRuntime,autogen_ne_Tensor)4089 TEST(StaticRuntime, autogen_ne_Tensor) {
4090 const std::string script = R"IR(
4091 graph(%self: Tensor, %other: Tensor):
4092 %bias: None = prim::Constant()
4093 %ret = aten::ne(%self, %other)
4094 %cloned = aten::clone(%ret, %bias)
4095 return (%cloned)
4096 )IR";
4097
4098 auto self0 = at::rand({6, 6, 6});
4099 auto other0 = at::rand({6, 6, 6});
4100 std::vector<IValue> args{self0, other0};
4101 testStaticRuntime(
4102 script,
4103 args,
4104 {},
4105 /*use_allclose=*/false,
4106 /*use_equalnan=*/false,
4107 /*check_resize=*/true);
4108
4109 auto self1 = at::rand({22, 22, 22});
4110 auto other1 = at::rand({22, 22, 22});
4111 std::vector<IValue> args2{self1, other1};
4112 testStaticRuntime(
4113 script,
4114 args,
4115 args2,
4116 /*use_allclose=*/false,
4117 /*use_equalnan=*/false,
4118 /*check_resize=*/true);
4119 }
4120
TEST(StaticRuntime,autogen_ge_Scalar)4121 TEST(StaticRuntime, autogen_ge_Scalar) {
4122 const std::string script = R"IR(
4123 graph(%self: Tensor, %other: int):
4124 %bias: None = prim::Constant()
4125 %ret = aten::ge(%self, %other)
4126 %cloned = aten::clone(%ret, %bias)
4127 return (%cloned)
4128 )IR";
4129
4130 auto self0 = at::rand({6, 6, 6});
4131 auto other0 = 2;
4132 std::vector<IValue> args{self0, other0};
4133 testStaticRuntime(
4134 script,
4135 args,
4136 {},
4137 /*use_allclose=*/false,
4138 /*use_equalnan=*/false,
4139 /*check_resize=*/true);
4140
4141 auto self1 = at::rand({22, 22, 22});
4142 auto other1 = 2;
4143 std::vector<IValue> args2{self1, other1};
4144 testStaticRuntime(
4145 script,
4146 args,
4147 args2,
4148 /*use_allclose=*/false,
4149 /*use_equalnan=*/false,
4150 /*check_resize=*/true);
4151 }
4152
TEST(StaticRuntime,autogen_ge_Tensor)4153 TEST(StaticRuntime, autogen_ge_Tensor) {
4154 const std::string script = R"IR(
4155 graph(%self: Tensor, %other: Tensor):
4156 %bias: None = prim::Constant()
4157 %ret = aten::ge(%self, %other)
4158 %cloned = aten::clone(%ret, %bias)
4159 return (%cloned)
4160 )IR";
4161
4162 auto self0 = at::rand({6, 6, 6});
4163 auto other0 = at::rand({6, 6, 6});
4164 std::vector<IValue> args{self0, other0};
4165 testStaticRuntime(
4166 script,
4167 args,
4168 {},
4169 /*use_allclose=*/false,
4170 /*use_equalnan=*/false,
4171 /*check_resize=*/true);
4172
4173 auto self1 = at::rand({22, 22, 22});
4174 auto other1 = at::rand({22, 22, 22});
4175 std::vector<IValue> args2{self1, other1};
4176 testStaticRuntime(
4177 script,
4178 args,
4179 args2,
4180 /*use_allclose=*/false,
4181 /*use_equalnan=*/false,
4182 /*check_resize=*/true);
4183 }
4184
TEST(StaticRuntime,autogen_le_Scalar)4185 TEST(StaticRuntime, autogen_le_Scalar) {
4186 const std::string script = R"IR(
4187 graph(%self: Tensor, %other: int):
4188 %bias: None = prim::Constant()
4189 %ret = aten::le(%self, %other)
4190 %cloned = aten::clone(%ret, %bias)
4191 return (%cloned)
4192 )IR";
4193
4194 auto self0 = at::rand({6, 6, 6});
4195 auto other0 = 2;
4196 std::vector<IValue> args{self0, other0};
4197 testStaticRuntime(
4198 script,
4199 args,
4200 {},
4201 /*use_allclose=*/false,
4202 /*use_equalnan=*/false,
4203 /*check_resize=*/true);
4204
4205 auto self1 = at::rand({22, 22, 22});
4206 auto other1 = 2;
4207 std::vector<IValue> args2{self1, other1};
4208 testStaticRuntime(
4209 script,
4210 args,
4211 args2,
4212 /*use_allclose=*/false,
4213 /*use_equalnan=*/false,
4214 /*check_resize=*/true);
4215 }
4216
TEST(StaticRuntime,autogen_le_Tensor)4217 TEST(StaticRuntime, autogen_le_Tensor) {
4218 const std::string script = R"IR(
4219 graph(%self: Tensor, %other: Tensor):
4220 %bias: None = prim::Constant()
4221 %ret = aten::le(%self, %other)
4222 %cloned = aten::clone(%ret, %bias)
4223 return (%cloned)
4224 )IR";
4225
4226 auto self0 = at::rand({6, 6, 6});
4227 auto other0 = at::rand({6, 6, 6});
4228 std::vector<IValue> args{self0, other0};
4229 testStaticRuntime(
4230 script,
4231 args,
4232 {},
4233 /*use_allclose=*/false,
4234 /*use_equalnan=*/false,
4235 /*check_resize=*/true);
4236
4237 auto self1 = at::rand({22, 22, 22});
4238 auto other1 = at::rand({22, 22, 22});
4239 std::vector<IValue> args2{self1, other1};
4240 testStaticRuntime(
4241 script,
4242 args,
4243 args2,
4244 /*use_allclose=*/false,
4245 /*use_equalnan=*/false,
4246 /*check_resize=*/true);
4247 }
4248
TEST(StaticRuntime,autogen_gt_Scalar)4249 TEST(StaticRuntime, autogen_gt_Scalar) {
4250 const std::string script = R"IR(
4251 graph(%self: Tensor, %other: int):
4252 %bias: None = prim::Constant()
4253 %ret = aten::gt(%self, %other)
4254 %cloned = aten::clone(%ret, %bias)
4255 return (%cloned)
4256 )IR";
4257
4258 auto self0 = at::rand({6, 6, 6});
4259 auto other0 = 2;
4260 std::vector<IValue> args{self0, other0};
4261 testStaticRuntime(
4262 script,
4263 args,
4264 {},
4265 /*use_allclose=*/false,
4266 /*use_equalnan=*/false,
4267 /*check_resize=*/true);
4268
4269 auto self1 = at::rand({22, 22, 22});
4270 auto other1 = 2;
4271 std::vector<IValue> args2{self1, other1};
4272 testStaticRuntime(
4273 script,
4274 args,
4275 args2,
4276 /*use_allclose=*/false,
4277 /*use_equalnan=*/false,
4278 /*check_resize=*/true);
4279 }
4280
TEST(StaticRuntime,autogen_gt_Tensor)4281 TEST(StaticRuntime, autogen_gt_Tensor) {
4282 const std::string script = R"IR(
4283 graph(%self: Tensor, %other: Tensor):
4284 %bias: None = prim::Constant()
4285 %ret = aten::gt(%self, %other)
4286 %cloned = aten::clone(%ret, %bias)
4287 return (%cloned)
4288 )IR";
4289
4290 auto self0 = at::rand({6, 6, 6});
4291 auto other0 = at::rand({6, 6, 6});
4292 std::vector<IValue> args{self0, other0};
4293 testStaticRuntime(
4294 script,
4295 args,
4296 {},
4297 /*use_allclose=*/false,
4298 /*use_equalnan=*/false,
4299 /*check_resize=*/true);
4300
4301 auto self1 = at::rand({22, 22, 22});
4302 auto other1 = at::rand({22, 22, 22});
4303 std::vector<IValue> args2{self1, other1};
4304 testStaticRuntime(
4305 script,
4306 args,
4307 args2,
4308 /*use_allclose=*/false,
4309 /*use_equalnan=*/false,
4310 /*check_resize=*/true);
4311 }
4312
TEST(StaticRuntime,autogen_lt_Scalar)4313 TEST(StaticRuntime, autogen_lt_Scalar) {
4314 const std::string script = R"IR(
4315 graph(%self: Tensor, %other: int):
4316 %bias: None = prim::Constant()
4317 %ret = aten::lt(%self, %other)
4318 %cloned = aten::clone(%ret, %bias)
4319 return (%cloned)
4320 )IR";
4321
4322 auto self0 = at::rand({6, 6, 6});
4323 auto other0 = 2;
4324 std::vector<IValue> args{self0, other0};
4325 testStaticRuntime(
4326 script,
4327 args,
4328 {},
4329 /*use_allclose=*/false,
4330 /*use_equalnan=*/false,
4331 /*check_resize=*/true);
4332
4333 auto self1 = at::rand({22, 22, 22});
4334 auto other1 = 2;
4335 std::vector<IValue> args2{self1, other1};
4336 testStaticRuntime(
4337 script,
4338 args,
4339 args2,
4340 /*use_allclose=*/false,
4341 /*use_equalnan=*/false,
4342 /*check_resize=*/true);
4343 }
4344
TEST(StaticRuntime,autogen_lt_Tensor)4345 TEST(StaticRuntime, autogen_lt_Tensor) {
4346 const std::string script = R"IR(
4347 graph(%self: Tensor, %other: Tensor):
4348 %bias: None = prim::Constant()
4349 %ret = aten::lt(%self, %other)
4350 %cloned = aten::clone(%ret, %bias)
4351 return (%cloned)
4352 )IR";
4353
4354 auto self0 = at::rand({6, 6, 6});
4355 auto other0 = at::rand({6, 6, 6});
4356 std::vector<IValue> args{self0, other0};
4357 testStaticRuntime(
4358 script,
4359 args,
4360 {},
4361 /*use_allclose=*/false,
4362 /*use_equalnan=*/false,
4363 /*check_resize=*/true);
4364
4365 auto self1 = at::rand({22, 22, 22});
4366 auto other1 = at::rand({22, 22, 22});
4367 std::vector<IValue> args2{self1, other1};
4368 testStaticRuntime(
4369 script,
4370 args,
4371 args2,
4372 /*use_allclose=*/false,
4373 /*use_equalnan=*/false,
4374 /*check_resize=*/true);
4375 }
4376
TEST(StaticRuntime,autogen_take)4377 TEST(StaticRuntime, autogen_take) {
4378 const std::string script = R"IR(
4379 graph(%self: Tensor, %index: Tensor):
4380 %bias: None = prim::Constant()
4381 %ret = aten::take(%self, %index)
4382 %cloned = aten::clone(%ret, %bias)
4383 return (%cloned)
4384 )IR";
4385
4386 auto self0 = at::rand({6, 6, 6});
4387 auto index0 = at::randint(0, 216, {20}, torch::kInt64);
4388 std::vector<IValue> args{self0, index0};
4389 testStaticRuntime(
4390 script,
4391 args,
4392 {},
4393 /*use_allclose=*/false,
4394 /*use_equalnan=*/false,
4395 /*check_resize=*/true);
4396
4397 auto self1 = at::rand({22, 22, 22});
4398 auto index1 = at::randint(0, 1000, {100}, torch::kInt64);
4399 std::vector<IValue> args2{self1, index1};
4400 testStaticRuntime(
4401 script,
4402 args,
4403 args2,
4404 /*use_allclose=*/false,
4405 /*use_equalnan=*/false,
4406 /*check_resize=*/true);
4407 }
4408
TEST(StaticRuntime,autogen_take_along_dim)4409 TEST(StaticRuntime, autogen_take_along_dim) {
4410 const std::string script = R"IR(
4411 graph(%self: Tensor, %indices: Tensor, %dim: int?):
4412 %bias: None = prim::Constant()
4413 %ret = aten::take_along_dim(%self, %indices, %dim)
4414 %cloned = aten::clone(%ret, %bias)
4415 return (%cloned)
4416 )IR";
4417
4418 auto self0 = at::rand({6, 6, 6});
4419 auto indices0 = at::argsort(self0, 1, true);
4420 auto dim0 = 1;
4421 std::vector<IValue> args{self0, indices0, dim0};
4422 testStaticRuntime(
4423 script,
4424 args,
4425 {},
4426 /*use_allclose=*/false,
4427 /*use_equalnan=*/false,
4428 /*check_resize=*/true);
4429
4430 auto self1 = at::rand({22, 22, 22});
4431 auto indices1 = at::argsort(self1, 1, true);
4432 auto dim1 = 1;
4433 std::vector<IValue> args2{self1, indices1, dim1};
4434 testStaticRuntime(
4435 script,
4436 args,
4437 args2,
4438 /*use_allclose=*/false,
4439 /*use_equalnan=*/false,
4440 /*check_resize=*/true);
4441 }
4442
TEST(StaticRuntime,autogen_masked_select)4443 TEST(StaticRuntime, autogen_masked_select) {
4444 const std::string script = R"IR(
4445 graph(%self: Tensor, %mask: Tensor):
4446 %bias: None = prim::Constant()
4447 %ret = aten::masked_select(%self, %mask)
4448 %cloned = aten::clone(%ret, %bias)
4449 return (%cloned)
4450 )IR";
4451
4452 auto self0 = at::rand({6, 6, 6});
4453 auto mask0 = at::randn({6, 6, 6}) > 0.5;
4454 std::vector<IValue> args{self0, mask0};
4455 testStaticRuntime(
4456 script,
4457 args,
4458 {},
4459 /*use_allclose=*/false,
4460 /*use_equalnan=*/false,
4461 /*check_resize=*/true);
4462
4463 auto self1 = at::rand({22, 22, 22});
4464 auto mask1 = at::rand({22, 22, 22}) > 0.5;
4465 std::vector<IValue> args2{self1, mask1};
4466 testStaticRuntime(
4467 script,
4468 args,
4469 args2,
4470 /*use_allclose=*/false,
4471 /*use_equalnan=*/false,
4472 /*check_resize=*/true);
4473 }
4474
TEST(StaticRuntime,autogen_nonzero_static)4475 TEST(StaticRuntime, autogen_nonzero_static) {
4476 const std::string script = R"IR(
4477 graph(%self: Tensor, %size: int, %fill_value: int):
4478 %bias: None = prim::Constant()
4479 %ret = aten::nonzero_static(%self, %size, %fill_value)
4480 %cloned = aten::clone(%ret, %bias)
4481 return (%cloned)
4482 )IR";
4483
4484 auto self0 = at::rand({6, 6, 6});
4485 auto size0 = 1;
4486 auto fill_value0 = 1;
4487 std::vector<IValue> args{self0, size0, fill_value0};
4488 testStaticRuntime(
4489 script,
4490 args,
4491 {},
4492 /*use_allclose=*/false,
4493 /*use_equalnan=*/false,
4494 /*check_resize=*/true);
4495
4496 auto self1 = at::rand({22, 22, 22});
4497 auto size1 = 1;
4498 auto fill_value1 = 1;
4499 std::vector<IValue> args2{self1, size1, fill_value1};
4500 testStaticRuntime(
4501 script,
4502 args,
4503 args2,
4504 /*use_allclose=*/false,
4505 /*use_equalnan=*/false,
4506 /*check_resize=*/true);
4507 }
4508
TEST(StaticRuntime,autogen_gather)4509 TEST(StaticRuntime, autogen_gather) {
4510 const std::string script = R"IR(
4511 graph(%self: Tensor, %dim: int, %index: Tensor, %sparse_grad: bool):
4512 %bias: None = prim::Constant()
4513 %ret = aten::gather(%self, %dim, %index, %sparse_grad)
4514 %cloned = aten::clone(%ret, %bias)
4515 return (%cloned)
4516 )IR";
4517
4518 auto self0 = at::randint(1, 100, {2, 2, 2}, at::kInt);
4519 auto dim0 = 1;
4520 auto index0 = at::randint(0, 1, {2, 2, 2}, torch::kInt64);
4521 auto sparse_grad0 = false;
4522 std::vector<IValue> args{self0, dim0, index0, sparse_grad0};
4523 testStaticRuntime(
4524 script,
4525 args,
4526 {},
4527 /*use_allclose=*/false,
4528 /*use_equalnan=*/false,
4529 /*check_resize=*/true);
4530
4531 auto self1 = at::randint(1, 100, {5, 5, 5}, at::kInt);
4532 auto dim1 = 1;
4533 auto index1 = at::randint(0, 4, {5, 5, 5}, torch::kInt64);
4534 auto sparse_grad1 = false;
4535 std::vector<IValue> args2{self1, dim1, index1, sparse_grad1};
4536 testStaticRuntime(
4537 script,
4538 args,
4539 args2,
4540 /*use_allclose=*/false,
4541 /*use_equalnan=*/false,
4542 /*check_resize=*/true);
4543 }
4544
TEST(StaticRuntime,autogen_addcmul)4545 TEST(StaticRuntime, autogen_addcmul) {
4546 const std::string script = R"IR(
4547 graph(%self: Tensor, %tensor1: Tensor, %tensor2: Tensor, %value: int):
4548 %bias: None = prim::Constant()
4549 %ret = aten::addcmul(%self, %tensor1, %tensor2, %value)
4550 %cloned = aten::clone(%ret, %bias)
4551 return (%cloned)
4552 )IR";
4553
4554 auto self0 = at::rand({6, 6, 6});
4555 auto tensor10 = at::rand({6, 6, 6});
4556 auto tensor20 = at::rand({6, 6, 6});
4557 auto value0 = 2;
4558 std::vector<IValue> args{self0, tensor10, tensor20, value0};
4559 testStaticRuntime(
4560 script,
4561 args,
4562 {},
4563 /*use_allclose=*/false,
4564 /*use_equalnan=*/false,
4565 /*check_resize=*/true);
4566
4567 auto self1 = at::rand({22, 22, 22});
4568 auto tensor11 = at::rand({22, 22, 22});
4569 auto tensor21 = at::rand({22, 22, 22});
4570 auto value1 = 2;
4571 std::vector<IValue> args2{self1, tensor11, tensor21, value1};
4572 testStaticRuntime(
4573 script,
4574 args,
4575 args2,
4576 /*use_allclose=*/false,
4577 /*use_equalnan=*/false,
4578 /*check_resize=*/true);
4579 }
4580
TEST(StaticRuntime,autogen_addcdiv)4581 TEST(StaticRuntime, autogen_addcdiv) {
4582 const std::string script = R"IR(
4583 graph(%self: Tensor, %tensor1: Tensor, %tensor2: Tensor, %value: int):
4584 %bias: None = prim::Constant()
4585 %ret = aten::addcdiv(%self, %tensor1, %tensor2, %value)
4586 %cloned = aten::clone(%ret, %bias)
4587 return (%cloned)
4588 )IR";
4589
4590 auto self0 = at::rand({6, 6, 6});
4591 auto tensor10 = at::rand({6, 6, 6});
4592 auto tensor20 = at::rand({6, 6, 6});
4593 auto value0 = 2;
4594 std::vector<IValue> args{self0, tensor10, tensor20, value0};
4595 testStaticRuntime(
4596 script,
4597 args,
4598 {},
4599 /*use_allclose=*/false,
4600 /*use_equalnan=*/false,
4601 /*check_resize=*/true);
4602
4603 auto self1 = at::rand({22, 22, 22});
4604 auto tensor11 = at::rand({22, 22, 22});
4605 auto tensor21 = at::rand({22, 22, 22});
4606 auto value1 = 2;
4607 std::vector<IValue> args2{self1, tensor11, tensor21, value1};
4608 testStaticRuntime(
4609 script,
4610 args,
4611 args2,
4612 /*use_allclose=*/false,
4613 /*use_equalnan=*/false,
4614 /*check_resize=*/true);
4615 }
4616
TEST(StaticRuntime,autogen_linalg_solve_triangular)4617 TEST(StaticRuntime, autogen_linalg_solve_triangular) {
4618 const std::string script = R"IR(
4619 graph(%self: Tensor, %B: Tensor, %upper: bool, %left: bool, %unitriangular: bool):
4620 %bias: None = prim::Constant()
4621 %ret = aten::linalg_solve_triangular(%self, %B, %upper, %left, %unitriangular)
4622 %cloned = aten::clone(%ret, %bias)
4623 return (%cloned)
4624 )IR";
4625
4626 auto self0 = at::rand({6, 6, 6});
4627 auto B0 = at::rand({6, 6, 6});
4628 auto upper0 = false;
4629 auto left0 = false;
4630 auto unitriangular0 = false;
4631 std::vector<IValue> args{self0, B0, upper0, left0, unitriangular0};
4632 testStaticRuntime(
4633 script,
4634 args,
4635 {},
4636 /*use_allclose=*/false,
4637 /*use_equalnan=*/false,
4638 /*check_resize=*/true);
4639
4640 auto self1 = at::rand({22, 22, 22});
4641 auto B1 = at::rand({22, 22, 22});
4642 auto upper1 = false;
4643 auto left1 = false;
4644 auto unitriangular1 = false;
4645 std::vector<IValue> args2{self1, B1, upper1, left1, unitriangular1};
4646 testStaticRuntime(
4647 script,
4648 args,
4649 args2,
4650 /*use_allclose=*/false,
4651 /*use_equalnan=*/false,
4652 /*check_resize=*/true);
4653 }
4654
TEST(StaticRuntime,autogen_cholesky_solve)4655 TEST(StaticRuntime, autogen_cholesky_solve) {
4656 const std::string script = R"IR(
4657 graph(%self: Tensor, %input2: Tensor, %upper: bool):
4658 %bias: None = prim::Constant()
4659 %ret = aten::cholesky_solve(%self, %input2, %upper)
4660 %cloned = aten::clone(%ret, %bias)
4661 return (%cloned)
4662 )IR";
4663
4664 auto self0 = at::rand({6, 6, 6});
4665 auto input20 = at::rand({6, 6, 6});
4666 auto upper0 = false;
4667 std::vector<IValue> args{self0, input20, upper0};
4668 testStaticRuntime(
4669 script,
4670 args,
4671 {},
4672 /*use_allclose=*/false,
4673 /*use_equalnan=*/false,
4674 /*check_resize=*/true);
4675
4676 auto self1 = at::rand({22, 22, 22});
4677 auto input21 = at::rand({22, 22, 22});
4678 auto upper1 = false;
4679 std::vector<IValue> args2{self1, input21, upper1};
4680 testStaticRuntime(
4681 script,
4682 args,
4683 args2,
4684 /*use_allclose=*/false,
4685 /*use_equalnan=*/false,
4686 /*check_resize=*/true);
4687 }
4688
TEST(StaticRuntime,autogen_cholesky_inverse)4689 TEST(StaticRuntime, autogen_cholesky_inverse) {
4690 const std::string script = R"IR(
4691 graph(%self: Tensor, %upper: bool):
4692 %bias: None = prim::Constant()
4693 %ret = aten::cholesky_inverse(%self, %upper)
4694 %cloned = aten::clone(%ret, %bias)
4695 return (%cloned)
4696 )IR";
4697
4698 auto self0 = at::rand({6, 6, 6});
4699 auto upper0 = false;
4700 std::vector<IValue> args{self0, upper0};
4701 testStaticRuntime(
4702 script,
4703 args,
4704 {},
4705 /*use_allclose=*/false,
4706 /*use_equalnan=*/false,
4707 /*check_resize=*/true);
4708
4709 auto self1 = at::rand({22, 22, 22});
4710 auto upper1 = false;
4711 std::vector<IValue> args2{self1, upper1};
4712 testStaticRuntime(
4713 script,
4714 args,
4715 args2,
4716 /*use_allclose=*/false,
4717 /*use_equalnan=*/false,
4718 /*check_resize=*/true);
4719 }
4720
TEST(StaticRuntime,autogen_orgqr)4721 TEST(StaticRuntime, autogen_orgqr) {
4722 const std::string script = R"IR(
4723 graph(%self: Tensor, %input2: Tensor):
4724 %bias: None = prim::Constant()
4725 %ret = aten::orgqr(%self, %input2)
4726 %cloned = aten::clone(%ret, %bias)
4727 return (%cloned)
4728 )IR";
4729
4730 auto self0 = at::rand({6, 6, 6});
4731 auto input20 = at::rand({6, 6});
4732 std::vector<IValue> args{self0, input20};
4733 testStaticRuntime(
4734 script,
4735 args,
4736 {},
4737 /*use_allclose=*/false,
4738 /*use_equalnan=*/false,
4739 /*check_resize=*/true);
4740
4741 auto self1 = at::rand({22, 22, 22});
4742 auto input21 = at::rand({22, 22});
4743 std::vector<IValue> args2{self1, input21};
4744 testStaticRuntime(
4745 script,
4746 args,
4747 args2,
4748 /*use_allclose=*/false,
4749 /*use_equalnan=*/false,
4750 /*check_resize=*/true);
4751 }
4752
TEST(StaticRuntime,autogen_ormqr)4753 TEST(StaticRuntime, autogen_ormqr) {
4754 const std::string script = R"IR(
4755 graph(%self: Tensor, %input2: Tensor, %input3: Tensor, %left: bool, %transpose: bool):
4756 %bias: None = prim::Constant()
4757 %ret = aten::ormqr(%self, %input2, %input3, %left, %transpose)
4758 %cloned = aten::clone(%ret, %bias)
4759 return (%cloned)
4760 )IR";
4761
4762 auto self0 = at::rand({6, 6, 6});
4763 auto input20 = at::rand({6, 6});
4764 auto input30 = at::rand({6, 6, 6});
4765 auto left0 = false;
4766 auto transpose0 = false;
4767 std::vector<IValue> args{self0, input20, input30, left0, transpose0};
4768 testStaticRuntime(
4769 script,
4770 args,
4771 {},
4772 /*use_allclose=*/false,
4773 /*use_equalnan=*/false,
4774 /*check_resize=*/true);
4775
4776 auto self1 = at::rand({22, 22, 22});
4777 auto input21 = at::rand({22, 22});
4778 auto input31 = at::rand({22, 22, 22});
4779 auto left1 = false;
4780 auto transpose1 = false;
4781 std::vector<IValue> args2{self1, input21, input31, left1, transpose1};
4782 testStaticRuntime(
4783 script,
4784 args,
4785 args2,
4786 /*use_allclose=*/false,
4787 /*use_equalnan=*/false,
4788 /*check_resize=*/true);
4789 }
4790
TEST(StaticRuntime,autogen_lgamma)4791 TEST(StaticRuntime, autogen_lgamma) {
4792 const std::string script = R"IR(
4793 graph(%self: Tensor):
4794 %bias: None = prim::Constant()
4795 %ret = aten::lgamma(%self)
4796 %cloned = aten::clone(%ret, %bias)
4797 return (%cloned)
4798 )IR";
4799
4800 auto self0 = at::rand({6, 6, 6});
4801 std::vector<IValue> args{self0};
4802 testStaticRuntime(
4803 script,
4804 args,
4805 {},
4806 /*use_allclose=*/false,
4807 /*use_equalnan=*/false,
4808 /*check_resize=*/true);
4809
4810 auto self1 = at::rand({22, 22, 22});
4811 std::vector<IValue> args2{self1};
4812 testStaticRuntime(
4813 script,
4814 args,
4815 args2,
4816 /*use_allclose=*/false,
4817 /*use_equalnan=*/false,
4818 /*check_resize=*/true);
4819 }
4820
TEST(StaticRuntime,autogen_polygamma)4821 TEST(StaticRuntime, autogen_polygamma) {
4822 const std::string script = R"IR(
4823 graph(%n: int, %self: Tensor):
4824 %bias: None = prim::Constant()
4825 %ret = aten::polygamma(%n, %self)
4826 %cloned = aten::clone(%ret, %bias)
4827 return (%cloned)
4828 )IR";
4829
4830 auto n0 = 1;
4831 auto self0 = at::rand({6, 6, 6});
4832 std::vector<IValue> args{n0, self0};
4833 testStaticRuntime(
4834 script,
4835 args,
4836 {},
4837 /*use_allclose=*/false,
4838 /*use_equalnan=*/false,
4839 /*check_resize=*/true);
4840
4841 auto n1 = 1;
4842 auto self1 = at::rand({22, 22, 22});
4843 std::vector<IValue> args2{n1, self1};
4844 testStaticRuntime(
4845 script,
4846 args,
4847 args2,
4848 /*use_allclose=*/false,
4849 /*use_equalnan=*/false,
4850 /*check_resize=*/true);
4851 }
4852
TEST(StaticRuntime,autogen_erfinv)4853 TEST(StaticRuntime, autogen_erfinv) {
4854 const std::string script = R"IR(
4855 graph(%self: Tensor):
4856 %bias: None = prim::Constant()
4857 %ret = aten::erfinv(%self)
4858 %cloned = aten::clone(%ret, %bias)
4859 return (%cloned)
4860 )IR";
4861
4862 auto self0 = at::rand({6, 6, 6});
4863 std::vector<IValue> args{self0};
4864 testStaticRuntime(
4865 script,
4866 args,
4867 {},
4868 /*use_allclose=*/false,
4869 /*use_equalnan=*/false,
4870 /*check_resize=*/true);
4871
4872 auto self1 = at::rand({22, 22, 22});
4873 std::vector<IValue> args2{self1};
4874 testStaticRuntime(
4875 script,
4876 args,
4877 args2,
4878 /*use_allclose=*/false,
4879 /*use_equalnan=*/false,
4880 /*check_resize=*/true);
4881 }
4882
TEST(StaticRuntime,autogen_i0)4883 TEST(StaticRuntime, autogen_i0) {
4884 const std::string script = R"IR(
4885 graph(%self: Tensor):
4886 %bias: None = prim::Constant()
4887 %ret = aten::i0(%self)
4888 %cloned = aten::clone(%ret, %bias)
4889 return (%cloned)
4890 )IR";
4891
4892 auto self0 = at::rand({6, 6, 6});
4893 std::vector<IValue> args{self0};
4894 testStaticRuntime(
4895 script,
4896 args,
4897 {},
4898 /*use_allclose=*/false,
4899 /*use_equalnan=*/false,
4900 /*check_resize=*/true);
4901
4902 auto self1 = at::rand({22, 22, 22});
4903 std::vector<IValue> args2{self1};
4904 testStaticRuntime(
4905 script,
4906 args,
4907 args2,
4908 /*use_allclose=*/false,
4909 /*use_equalnan=*/false,
4910 /*check_resize=*/true);
4911 }
4912
TEST(StaticRuntime,autogen_signbit)4913 TEST(StaticRuntime, autogen_signbit) {
4914 const std::string script = R"IR(
4915 graph(%self: Tensor):
4916 %bias: None = prim::Constant()
4917 %ret = aten::signbit(%self)
4918 %cloned = aten::clone(%ret, %bias)
4919 return (%cloned)
4920 )IR";
4921
4922 auto self0 = at::rand({6, 6, 6});
4923 std::vector<IValue> args{self0};
4924 testStaticRuntime(
4925 script,
4926 args,
4927 {},
4928 /*use_allclose=*/false,
4929 /*use_equalnan=*/false,
4930 /*check_resize=*/true);
4931
4932 auto self1 = at::rand({22, 22, 22});
4933 std::vector<IValue> args2{self1};
4934 testStaticRuntime(
4935 script,
4936 args,
4937 args2,
4938 /*use_allclose=*/false,
4939 /*use_equalnan=*/false,
4940 /*check_resize=*/true);
4941 }
4942
TEST(StaticRuntime,autogen_atan2)4943 TEST(StaticRuntime, autogen_atan2) {
4944 const std::string script = R"IR(
4945 graph(%self: Tensor, %other: Tensor):
4946 %bias: None = prim::Constant()
4947 %ret = aten::atan2(%self, %other)
4948 %cloned = aten::clone(%ret, %bias)
4949 return (%cloned)
4950 )IR";
4951
4952 auto self0 = at::rand({6, 6, 6});
4953 auto other0 = at::rand({6, 6, 6});
4954 std::vector<IValue> args{self0, other0};
4955 testStaticRuntime(
4956 script,
4957 args,
4958 {},
4959 /*use_allclose=*/false,
4960 /*use_equalnan=*/false,
4961 /*check_resize=*/true);
4962
4963 auto self1 = at::rand({22, 22, 22});
4964 auto other1 = at::rand({22, 22, 22});
4965 std::vector<IValue> args2{self1, other1};
4966 testStaticRuntime(
4967 script,
4968 args,
4969 args2,
4970 /*use_allclose=*/false,
4971 /*use_equalnan=*/false,
4972 /*check_resize=*/true);
4973 }
4974
TEST(StaticRuntime,autogen_arctan2)4975 TEST(StaticRuntime, autogen_arctan2) {
4976 const std::string script = R"IR(
4977 graph(%self: Tensor, %other: Tensor):
4978 %bias: None = prim::Constant()
4979 %ret = aten::arctan2(%self, %other)
4980 %cloned = aten::clone(%ret, %bias)
4981 return (%cloned)
4982 )IR";
4983
4984 auto self0 = at::rand({6, 6, 6});
4985 auto other0 = at::rand({6, 6, 6});
4986 std::vector<IValue> args{self0, other0};
4987 testStaticRuntime(
4988 script,
4989 args,
4990 {},
4991 /*use_allclose=*/false,
4992 /*use_equalnan=*/false,
4993 /*check_resize=*/true);
4994
4995 auto self1 = at::rand({22, 22, 22});
4996 auto other1 = at::rand({22, 22, 22});
4997 std::vector<IValue> args2{self1, other1};
4998 testStaticRuntime(
4999 script,
5000 args,
5001 args2,
5002 /*use_allclose=*/false,
5003 /*use_equalnan=*/false,
5004 /*check_resize=*/true);
5005 }
5006
TEST(StaticRuntime,autogen_histc)5007 TEST(StaticRuntime, autogen_histc) {
5008 const std::string script = R"IR(
5009 graph(%self: Tensor, %bins: int, %min: int, %max: int):
5010 %bias: None = prim::Constant()
5011 %ret = aten::histc(%self, %bins, %min, %max)
5012 %cloned = aten::clone(%ret, %bias)
5013 return (%cloned)
5014 )IR";
5015
5016 auto self0 = at::rand({6, 6, 6});
5017 auto bins0 = 1;
5018 auto min0 = 2;
5019 auto max0 = 2;
5020 std::vector<IValue> args{self0, bins0, min0, max0};
5021 testStaticRuntime(
5022 script,
5023 args,
5024 {},
5025 /*use_allclose=*/false,
5026 /*use_equalnan=*/false,
5027 /*check_resize=*/false);
5028
5029 auto self1 = at::rand({22, 22, 22});
5030 auto bins1 = 1;
5031 auto min1 = 2;
5032 auto max1 = 2;
5033 std::vector<IValue> args2{self1, bins1, min1, max1};
5034 testStaticRuntime(
5035 script,
5036 args,
5037 args2,
5038 /*use_allclose=*/false,
5039 /*use_equalnan=*/false,
5040 /*check_resize=*/false);
5041 }
5042
TEST(StaticRuntime,autogen_hypot)5043 TEST(StaticRuntime, autogen_hypot) {
5044 const std::string script = R"IR(
5045 graph(%self: Tensor, %other: Tensor):
5046 %bias: None = prim::Constant()
5047 %ret = aten::hypot(%self, %other)
5048 %cloned = aten::clone(%ret, %bias)
5049 return (%cloned)
5050 )IR";
5051
5052 auto self0 = at::rand({6, 6, 6});
5053 auto other0 = at::rand({6, 6, 6});
5054 std::vector<IValue> args{self0, other0};
5055 testStaticRuntime(
5056 script,
5057 args,
5058 {},
5059 /*use_allclose=*/false,
5060 /*use_equalnan=*/false,
5061 /*check_resize=*/true);
5062
5063 auto self1 = at::rand({22, 22, 22});
5064 auto other1 = at::rand({22, 22, 22});
5065 std::vector<IValue> args2{self1, other1};
5066 testStaticRuntime(
5067 script,
5068 args,
5069 args2,
5070 /*use_allclose=*/false,
5071 /*use_equalnan=*/false,
5072 /*check_resize=*/true);
5073 }
5074
TEST(StaticRuntime,autogen_igamma)5075 TEST(StaticRuntime, autogen_igamma) {
5076 const std::string script = R"IR(
5077 graph(%self: Tensor, %other: Tensor):
5078 %bias: None = prim::Constant()
5079 %ret = aten::igamma(%self, %other)
5080 %cloned = aten::clone(%ret, %bias)
5081 return (%cloned)
5082 )IR";
5083
5084 auto self0 = at::rand({6, 6, 6});
5085 auto other0 = at::rand({6, 6, 6});
5086 std::vector<IValue> args{self0, other0};
5087 testStaticRuntime(
5088 script,
5089 args,
5090 {},
5091 /*use_allclose=*/false,
5092 /*use_equalnan=*/false,
5093 /*check_resize=*/true);
5094
5095 auto self1 = at::rand({22, 22, 22});
5096 auto other1 = at::rand({22, 22, 22});
5097 std::vector<IValue> args2{self1, other1};
5098 testStaticRuntime(
5099 script,
5100 args,
5101 args2,
5102 /*use_allclose=*/false,
5103 /*use_equalnan=*/false,
5104 /*check_resize=*/true);
5105 }
5106
TEST(StaticRuntime,autogen_igammac)5107 TEST(StaticRuntime, autogen_igammac) {
5108 const std::string script = R"IR(
5109 graph(%self: Tensor, %other: Tensor):
5110 %bias: None = prim::Constant()
5111 %ret = aten::igammac(%self, %other)
5112 %cloned = aten::clone(%ret, %bias)
5113 return (%cloned)
5114 )IR";
5115
5116 auto self0 = at::rand({6, 6, 6});
5117 auto other0 = at::rand({6, 6, 6});
5118 std::vector<IValue> args{self0, other0};
5119 testStaticRuntime(
5120 script,
5121 args,
5122 {},
5123 /*use_allclose=*/false,
5124 /*use_equalnan=*/false,
5125 /*check_resize=*/true);
5126
5127 auto self1 = at::rand({22, 22, 22});
5128 auto other1 = at::rand({22, 22, 22});
5129 std::vector<IValue> args2{self1, other1};
5130 testStaticRuntime(
5131 script,
5132 args,
5133 args2,
5134 /*use_allclose=*/false,
5135 /*use_equalnan=*/false,
5136 /*check_resize=*/true);
5137 }
5138
TEST(StaticRuntime,autogen_nextafter)5139 TEST(StaticRuntime, autogen_nextafter) {
5140 const std::string script = R"IR(
5141 graph(%self: Tensor, %other: Tensor):
5142 %bias: None = prim::Constant()
5143 %ret = aten::nextafter(%self, %other)
5144 %cloned = aten::clone(%ret, %bias)
5145 return (%cloned)
5146 )IR";
5147
5148 auto self0 = at::rand({6, 6, 6});
5149 auto other0 = at::rand({6, 6, 6});
5150 std::vector<IValue> args{self0, other0};
5151 testStaticRuntime(
5152 script,
5153 args,
5154 {},
5155 /*use_allclose=*/false,
5156 /*use_equalnan=*/false,
5157 /*check_resize=*/true);
5158
5159 auto self1 = at::rand({22, 22, 22});
5160 auto other1 = at::rand({22, 22, 22});
5161 std::vector<IValue> args2{self1, other1};
5162 testStaticRuntime(
5163 script,
5164 args,
5165 args2,
5166 /*use_allclose=*/false,
5167 /*use_equalnan=*/false,
5168 /*check_resize=*/true);
5169 }
5170
TEST(StaticRuntime,autogen_fmin)5171 TEST(StaticRuntime, autogen_fmin) {
5172 const std::string script = R"IR(
5173 graph(%self: Tensor, %other: Tensor):
5174 %bias: None = prim::Constant()
5175 %ret = aten::fmin(%self, %other)
5176 %cloned = aten::clone(%ret, %bias)
5177 return (%cloned)
5178 )IR";
5179
5180 auto self0 = at::rand({6, 6, 6});
5181 auto other0 = at::rand({6, 6, 6});
5182 std::vector<IValue> args{self0, other0};
5183 testStaticRuntime(
5184 script,
5185 args,
5186 {},
5187 /*use_allclose=*/false,
5188 /*use_equalnan=*/false,
5189 /*check_resize=*/true);
5190
5191 auto self1 = at::rand({22, 22, 22});
5192 auto other1 = at::rand({22, 22, 22});
5193 std::vector<IValue> args2{self1, other1};
5194 testStaticRuntime(
5195 script,
5196 args,
5197 args2,
5198 /*use_allclose=*/false,
5199 /*use_equalnan=*/false,
5200 /*check_resize=*/true);
5201 }
5202
TEST(StaticRuntime,autogen_fmax)5203 TEST(StaticRuntime, autogen_fmax) {
5204 const std::string script = R"IR(
5205 graph(%self: Tensor, %other: Tensor):
5206 %bias: None = prim::Constant()
5207 %ret = aten::fmax(%self, %other)
5208 %cloned = aten::clone(%ret, %bias)
5209 return (%cloned)
5210 )IR";
5211
5212 auto self0 = at::rand({6, 6, 6});
5213 auto other0 = at::rand({6, 6, 6});
5214 std::vector<IValue> args{self0, other0};
5215 testStaticRuntime(
5216 script,
5217 args,
5218 {},
5219 /*use_allclose=*/false,
5220 /*use_equalnan=*/false,
5221 /*check_resize=*/true);
5222
5223 auto self1 = at::rand({22, 22, 22});
5224 auto other1 = at::rand({22, 22, 22});
5225 std::vector<IValue> args2{self1, other1};
5226 testStaticRuntime(
5227 script,
5228 args,
5229 args2,
5230 /*use_allclose=*/false,
5231 /*use_equalnan=*/false,
5232 /*check_resize=*/true);
5233 }
5234
TEST(StaticRuntime,autogen_maximum)5235 TEST(StaticRuntime, autogen_maximum) {
5236 const std::string script = R"IR(
5237 graph(%self: Tensor, %other: Tensor):
5238 %bias: None = prim::Constant()
5239 %ret = aten::maximum(%self, %other)
5240 %cloned = aten::clone(%ret, %bias)
5241 return (%cloned)
5242 )IR";
5243
5244 auto self0 = at::rand({6, 6, 6});
5245 auto other0 = at::rand({6, 6, 6});
5246 std::vector<IValue> args{self0, other0};
5247 testStaticRuntime(
5248 script,
5249 args,
5250 {},
5251 /*use_allclose=*/false,
5252 /*use_equalnan=*/false,
5253 /*check_resize=*/true);
5254
5255 auto self1 = at::rand({22, 22, 22});
5256 auto other1 = at::rand({22, 22, 22});
5257 std::vector<IValue> args2{self1, other1};
5258 testStaticRuntime(
5259 script,
5260 args,
5261 args2,
5262 /*use_allclose=*/false,
5263 /*use_equalnan=*/false,
5264 /*check_resize=*/true);
5265 }
5266
TEST(StaticRuntime,autogen_minimum)5267 TEST(StaticRuntime, autogen_minimum) {
5268 const std::string script = R"IR(
5269 graph(%self: Tensor, %other: Tensor):
5270 %bias: None = prim::Constant()
5271 %ret = aten::minimum(%self, %other)
5272 %cloned = aten::clone(%ret, %bias)
5273 return (%cloned)
5274 )IR";
5275
5276 auto self0 = at::rand({6, 6, 6});
5277 auto other0 = at::rand({6, 6, 6});
5278 std::vector<IValue> args{self0, other0};
5279 testStaticRuntime(
5280 script,
5281 args,
5282 {},
5283 /*use_allclose=*/false,
5284 /*use_equalnan=*/false,
5285 /*check_resize=*/true);
5286
5287 auto self1 = at::rand({22, 22, 22});
5288 auto other1 = at::rand({22, 22, 22});
5289 std::vector<IValue> args2{self1, other1};
5290 testStaticRuntime(
5291 script,
5292 args,
5293 args2,
5294 /*use_allclose=*/false,
5295 /*use_equalnan=*/false,
5296 /*check_resize=*/true);
5297 }
5298
TEST(StaticRuntime,autogen_min_other)5299 TEST(StaticRuntime, autogen_min_other) {
5300 const std::string script = R"IR(
5301 graph(%self: Tensor, %other: Tensor):
5302 %bias: None = prim::Constant()
5303 %ret = aten::min(%self, %other)
5304 %cloned = aten::clone(%ret, %bias)
5305 return (%cloned)
5306 )IR";
5307
5308 auto self0 = at::rand({6, 6, 6});
5309 auto other0 = at::rand({6, 6, 6});
5310 std::vector<IValue> args{self0, other0};
5311 testStaticRuntime(
5312 script,
5313 args,
5314 {},
5315 /*use_allclose=*/false,
5316 /*use_equalnan=*/false,
5317 /*check_resize=*/true);
5318
5319 auto self1 = at::rand({22, 22, 22});
5320 auto other1 = at::rand({22, 22, 22});
5321 std::vector<IValue> args2{self1, other1};
5322 testStaticRuntime(
5323 script,
5324 args,
5325 args2,
5326 /*use_allclose=*/false,
5327 /*use_equalnan=*/false,
5328 /*check_resize=*/true);
5329 }
5330
TEST(StaticRuntime,autogen_quantile)5331 TEST(StaticRuntime, autogen_quantile) {
5332 const std::string script = R"IR(
5333 graph(%self: Tensor, %q: Tensor, %dim: int?, %keepdim: bool, %interpolation: str):
5334 %bias: None = prim::Constant()
5335 %ret = aten::quantile(%self, %q, %dim, %keepdim, %interpolation)
5336 %cloned = aten::clone(%ret, %bias)
5337 return (%cloned)
5338 )IR";
5339
5340 auto self0 = at::rand({6, 6, 6});
5341 auto q0 = at::rand({6});
5342 auto dim0 = 1;
5343 auto keepdim0 = false;
5344 auto interpolation0 = "linear";
5345 std::vector<IValue> args{self0, q0, dim0, keepdim0, interpolation0};
5346 testStaticRuntime(
5347 script,
5348 args,
5349 {},
5350 /*use_allclose=*/false,
5351 /*use_equalnan=*/false,
5352 /*check_resize=*/true);
5353
5354 auto self1 = at::rand({22, 22, 22});
5355 auto q1 = at::rand({22});
5356 auto dim1 = 1;
5357 auto keepdim1 = false;
5358 auto interpolation1 = "linear";
5359 std::vector<IValue> args2{self1, q1, dim1, keepdim1, interpolation1};
5360 testStaticRuntime(
5361 script,
5362 args,
5363 args2,
5364 /*use_allclose=*/false,
5365 /*use_equalnan=*/false,
5366 /*check_resize=*/true);
5367 }
5368
TEST(StaticRuntime,autogen_nanquantile)5369 TEST(StaticRuntime, autogen_nanquantile) {
5370 const std::string script = R"IR(
5371 graph(%self: Tensor, %q: Tensor, %dim: int?, %keepdim: bool, %interpolation: str):
5372 %bias: None = prim::Constant()
5373 %ret = aten::nanquantile(%self, %q, %dim, %keepdim, %interpolation)
5374 %cloned = aten::clone(%ret, %bias)
5375 return (%cloned)
5376 )IR";
5377
5378 auto self0 = at::rand({6, 6, 6});
5379 auto q0 = at::rand({6});
5380 auto dim0 = 1;
5381 auto keepdim0 = false;
5382 auto interpolation0 = "linear";
5383 std::vector<IValue> args{self0, q0, dim0, keepdim0, interpolation0};
5384 testStaticRuntime(
5385 script,
5386 args,
5387 {},
5388 /*use_allclose=*/false,
5389 /*use_equalnan=*/false,
5390 /*check_resize=*/true);
5391
5392 auto self1 = at::rand({22, 22, 22});
5393 auto q1 = at::rand({22});
5394 auto dim1 = 1;
5395 auto keepdim1 = false;
5396 auto interpolation1 = "linear";
5397 std::vector<IValue> args2{self1, q1, dim1, keepdim1, interpolation1};
5398 testStaticRuntime(
5399 script,
5400 args,
5401 args2,
5402 /*use_allclose=*/false,
5403 /*use_equalnan=*/false,
5404 /*check_resize=*/true);
5405 }
5406
TEST(StaticRuntime,autogen_msort)5407 TEST(StaticRuntime, autogen_msort) {
5408 const std::string script = R"IR(
5409 graph(%self: Tensor):
5410 %bias: None = prim::Constant()
5411 %ret = aten::msort(%self)
5412 %cloned = aten::clone(%ret, %bias)
5413 return (%cloned)
5414 )IR";
5415
5416 auto self0 = at::rand({6, 6, 6});
5417 std::vector<IValue> args{self0};
5418 testStaticRuntime(
5419 script,
5420 args,
5421 {},
5422 /*use_allclose=*/false,
5423 /*use_equalnan=*/false,
5424 /*check_resize=*/true);
5425
5426 auto self1 = at::rand({22, 22, 22});
5427 std::vector<IValue> args2{self1};
5428 testStaticRuntime(
5429 script,
5430 args,
5431 args2,
5432 /*use_allclose=*/false,
5433 /*use_equalnan=*/false,
5434 /*check_resize=*/true);
5435 }
5436
TEST(StaticRuntime,autogen_renorm)5437 TEST(StaticRuntime, autogen_renorm) {
5438 const std::string script = R"IR(
5439 graph(%self: Tensor, %p: int, %dim: int, %maxnorm: int):
5440 %bias: None = prim::Constant()
5441 %ret = aten::renorm(%self, %p, %dim, %maxnorm)
5442 %cloned = aten::clone(%ret, %bias)
5443 return (%cloned)
5444 )IR";
5445
5446 auto self0 = at::rand({6, 6, 6});
5447 auto p0 = 2;
5448 auto dim0 = 1;
5449 auto maxnorm0 = 2;
5450 std::vector<IValue> args{self0, p0, dim0, maxnorm0};
5451 testStaticRuntime(
5452 script,
5453 args,
5454 {},
5455 /*use_allclose=*/false,
5456 /*use_equalnan=*/false,
5457 /*check_resize=*/true);
5458
5459 auto self1 = at::rand({22, 22, 22});
5460 auto p1 = 2;
5461 auto dim1 = 1;
5462 auto maxnorm1 = 2;
5463 std::vector<IValue> args2{self1, p1, dim1, maxnorm1};
5464 testStaticRuntime(
5465 script,
5466 args,
5467 args2,
5468 /*use_allclose=*/false,
5469 /*use_equalnan=*/false,
5470 /*check_resize=*/true);
5471 }
5472
TEST(StaticRuntime,autogen__convert_indices_from_coo_to_csr)5473 TEST(StaticRuntime, autogen__convert_indices_from_coo_to_csr) {
5474 const std::string script = R"IR(
5475 graph(%self: Tensor, %size: int, %out_int32: bool):
5476 %bias: None = prim::Constant()
5477 %ret = aten::_convert_indices_from_coo_to_csr(%self, %size, %out_int32)
5478 %cloned = aten::clone(%ret, %bias)
5479 return (%cloned)
5480 )IR";
5481
5482 auto self0 = at::randint(0, 3, {2}, at::kInt);
5483 auto size0 = 10;
5484 auto out_int320 = false;
5485 std::vector<IValue> args{self0, size0, out_int320};
5486 testStaticRuntime(
5487 script,
5488 args,
5489 {},
5490 /*use_allclose=*/false,
5491 /*use_equalnan=*/false,
5492 /*check_resize=*/true);
5493
5494 auto self1 = at::randint(0, 3, {12}, at::kInt);
5495 auto size1 = 24;
5496 auto out_int321 = false;
5497 std::vector<IValue> args2{self1, size1, out_int321};
5498 testStaticRuntime(
5499 script,
5500 args,
5501 args2,
5502 /*use_allclose=*/false,
5503 /*use_equalnan=*/false,
5504 /*check_resize=*/true);
5505 }
5506
TEST(StaticRuntime,autogen__convert_indices_from_csr_to_coo)5507 TEST(StaticRuntime, autogen__convert_indices_from_csr_to_coo) {
5508 const std::string script = R"IR(
5509 graph(%crow_indices: Tensor, %col_indices: Tensor, %out_int32: bool, %transpose: bool):
5510 %bias: None = prim::Constant()
5511 %ret = aten::_convert_indices_from_csr_to_coo(%crow_indices, %col_indices, %out_int32, %transpose)
5512 %cloned = aten::clone(%ret, %bias)
5513 return (%cloned)
5514 )IR";
5515
5516 auto crow_indices0 = torch::tensor({1}, torch::kInt32);
5517 auto col_indices0 = torch::tensor({0, 1, 0}, torch::kInt32);
5518 auto out_int320 = false;
5519 auto transpose0 = false;
5520 std::vector<IValue> args{crow_indices0, col_indices0, out_int320, transpose0};
5521 testStaticRuntime(
5522 script,
5523 args,
5524 {},
5525 /*use_allclose=*/false,
5526 /*use_equalnan=*/false,
5527 /*check_resize=*/true);
5528
5529 auto crow_indices1 = torch::tensor({0}, torch::kInt32);
5530 auto col_indices1 =
5531 torch::tensor({0, 1, 0, 2, 1, 2, 0, 1, 0, 2, 1, 2}, torch::kInt32);
5532 auto out_int321 = false;
5533 auto transpose1 = false;
5534 std::vector<IValue> args2{
5535 crow_indices1, col_indices1, out_int321, transpose1};
5536 testStaticRuntime(
5537 script,
5538 args,
5539 args2,
5540 /*use_allclose=*/false,
5541 /*use_equalnan=*/false,
5542 /*check_resize=*/true);
5543 }
5544
TEST(StaticRuntime,autogen_mse_loss)5545 TEST(StaticRuntime, autogen_mse_loss) {
5546 const std::string script = R"IR(
5547 graph(%self: Tensor, %target: Tensor, %reduction: int):
5548 %bias: None = prim::Constant()
5549 %ret = aten::mse_loss(%self, %target, %reduction)
5550 %cloned = aten::clone(%ret, %bias)
5551 return (%cloned)
5552 )IR";
5553
5554 auto self0 = at::rand({6, 6, 6});
5555 auto target0 = at::rand({6, 6, 6});
5556 auto reduction0 = 1;
5557 std::vector<IValue> args{self0, target0, reduction0};
5558 testStaticRuntime(
5559 script,
5560 args,
5561 {},
5562 /*use_allclose=*/false,
5563 /*use_equalnan=*/false,
5564 /*check_resize=*/true);
5565
5566 auto self1 = at::rand({22, 22, 22});
5567 auto target1 = at::rand({22, 22, 22});
5568 auto reduction1 = 1;
5569 std::vector<IValue> args2{self1, target1, reduction1};
5570 testStaticRuntime(
5571 script,
5572 args,
5573 args2,
5574 /*use_allclose=*/false,
5575 /*use_equalnan=*/false,
5576 /*check_resize=*/true);
5577 }
5578
TEST(StaticRuntime,autogen_multi_margin_loss)5579 TEST(StaticRuntime, autogen_multi_margin_loss) {
5580 const std::string script = R"IR(
5581 graph(%self: Tensor, %target: Tensor, %p: int, %margin: int, %weight: Tensor?, %reduction: int):
5582 %bias: None = prim::Constant()
5583 %ret = aten::multi_margin_loss(%self, %target, %p, %margin, %weight, %reduction)
5584 %cloned = aten::clone(%ret, %bias)
5585 return (%cloned)
5586 )IR";
5587
5588 auto self0 = at::rand({6, 6});
5589 auto target0 = at::randint(6, {6}, torch::kInt64);
5590 auto p0 = 2;
5591 auto margin0 = 2;
5592 auto weight0 = at::rand({6});
5593 auto reduction0 = 1;
5594 std::vector<IValue> args{self0, target0, p0, margin0, weight0, reduction0};
5595 testStaticRuntime(
5596 script,
5597 args,
5598 {},
5599 /*use_allclose=*/false,
5600 /*use_equalnan=*/false,
5601 /*check_resize=*/false);
5602
5603 auto self1 = at::rand({22, 22});
5604 auto target1 = at::randint(22, {22}, torch::kInt64);
5605 auto p1 = 2;
5606 auto margin1 = 2;
5607 auto weight1 = at::rand({22});
5608 auto reduction1 = 1;
5609 std::vector<IValue> args2{self1, target1, p1, margin1, weight1, reduction1};
5610 testStaticRuntime(
5611 script,
5612 args,
5613 args2,
5614 /*use_allclose=*/false,
5615 /*use_equalnan=*/false,
5616 /*check_resize=*/false);
5617 }
5618
TEST(StaticRuntime,autogen_multilabel_margin_loss)5619 TEST(StaticRuntime, autogen_multilabel_margin_loss) {
5620 const std::string script = R"IR(
5621 graph(%self: Tensor, %target: Tensor, %reduction: int):
5622 %bias: None = prim::Constant()
5623 %ret = aten::multilabel_margin_loss(%self, %target, %reduction)
5624 %cloned = aten::clone(%ret, %bias)
5625 return (%cloned)
5626 )IR";
5627
5628 auto self0 = at::rand({6, 6});
5629 auto target0 = at::randint(6, {6, 6}, torch::kInt64);
5630 auto reduction0 = 1;
5631 std::vector<IValue> args{self0, target0, reduction0};
5632 testStaticRuntime(
5633 script,
5634 args,
5635 {},
5636 /*use_allclose=*/false,
5637 /*use_equalnan=*/false,
5638 /*check_resize=*/false);
5639
5640 auto self1 = at::rand({22, 22});
5641 auto target1 = at::randint(22, {22, 22}, torch::kInt64);
5642 auto reduction1 = 1;
5643 std::vector<IValue> args2{self1, target1, reduction1};
5644 testStaticRuntime(
5645 script,
5646 args,
5647 args2,
5648 /*use_allclose=*/false,
5649 /*use_equalnan=*/false,
5650 /*check_resize=*/false);
5651 }
5652
TEST(StaticRuntime,autogen_soft_margin_loss)5653 TEST(StaticRuntime, autogen_soft_margin_loss) {
5654 const std::string script = R"IR(
5655 graph(%self: Tensor, %target: Tensor, %reduction: int):
5656 %bias: None = prim::Constant()
5657 %ret = aten::soft_margin_loss(%self, %target, %reduction)
5658 %cloned = aten::clone(%ret, %bias)
5659 return (%cloned)
5660 )IR";
5661
5662 auto self0 = at::rand({6, 6, 6});
5663 auto target0 = at::rand({6, 6, 6});
5664 auto reduction0 = 1;
5665 std::vector<IValue> args{self0, target0, reduction0};
5666 testStaticRuntime(
5667 script,
5668 args,
5669 {},
5670 /*use_allclose=*/false,
5671 /*use_equalnan=*/false,
5672 /*check_resize=*/true);
5673
5674 auto self1 = at::rand({22, 22, 22});
5675 auto target1 = at::rand({22, 22, 22});
5676 auto reduction1 = 1;
5677 std::vector<IValue> args2{self1, target1, reduction1};
5678 testStaticRuntime(
5679 script,
5680 args,
5681 args2,
5682 /*use_allclose=*/false,
5683 /*use_equalnan=*/false,
5684 /*check_resize=*/true);
5685 }
5686
TEST(StaticRuntime,autogen_elu)5687 TEST(StaticRuntime, autogen_elu) {
5688 const std::string script = R"IR(
5689 graph(%self: Tensor, %alpha: int, %scale: int, %input_scale: int):
5690 %bias: None = prim::Constant()
5691 %ret = aten::elu(%self, %alpha, %scale, %input_scale)
5692 %cloned = aten::clone(%ret, %bias)
5693 return (%cloned)
5694 )IR";
5695
5696 auto self0 = at::rand({6, 6, 6});
5697 auto alpha0 = 2;
5698 auto scale0 = 2;
5699 auto input_scale0 = 2;
5700 std::vector<IValue> args{self0, alpha0, scale0, input_scale0};
5701 testStaticRuntime(
5702 script,
5703 args,
5704 {},
5705 /*use_allclose=*/false,
5706 /*use_equalnan=*/false,
5707 /*check_resize=*/true);
5708
5709 auto self1 = at::rand({22, 22, 22});
5710 auto alpha1 = 2;
5711 auto scale1 = 2;
5712 auto input_scale1 = 2;
5713 std::vector<IValue> args2{self1, alpha1, scale1, input_scale1};
5714 testStaticRuntime(
5715 script,
5716 args,
5717 args2,
5718 /*use_allclose=*/false,
5719 /*use_equalnan=*/false,
5720 /*check_resize=*/true);
5721 }
5722
TEST(StaticRuntime,autogen_elu_backward)5723 TEST(StaticRuntime, autogen_elu_backward) {
5724 const std::string script = R"IR(
5725 graph(%grad_output: Tensor, %alpha: int, %scale: int, %input_scale: int, %is_result: bool, %self_or_result: Tensor):
5726 %bias: None = prim::Constant()
5727 %ret = aten::elu_backward(%grad_output, %alpha, %scale, %input_scale, %is_result, %self_or_result)
5728 %cloned = aten::clone(%ret, %bias)
5729 return (%cloned)
5730 )IR";
5731
5732 auto grad_output0 = at::rand({6, 6, 6});
5733 auto alpha0 = 2;
5734 auto scale0 = 2;
5735 auto input_scale0 = 2;
5736 auto is_result0 = false;
5737 auto self_or_result0 = at::rand({6, 6, 6});
5738 std::vector<IValue> args{
5739 grad_output0, alpha0, scale0, input_scale0, is_result0, self_or_result0};
5740 testStaticRuntime(
5741 script,
5742 args,
5743 {},
5744 /*use_allclose=*/false,
5745 /*use_equalnan=*/false,
5746 /*check_resize=*/true);
5747
5748 auto grad_output1 = at::rand({22, 22, 22});
5749 auto alpha1 = 2;
5750 auto scale1 = 2;
5751 auto input_scale1 = 2;
5752 auto is_result1 = false;
5753 auto self_or_result1 = at::rand({22, 22, 22});
5754 std::vector<IValue> args2{
5755 grad_output1, alpha1, scale1, input_scale1, is_result1, self_or_result1};
5756 testStaticRuntime(
5757 script,
5758 args,
5759 args2,
5760 /*use_allclose=*/false,
5761 /*use_equalnan=*/false,
5762 /*check_resize=*/true);
5763 }
5764
TEST(StaticRuntime,autogen_glu)5765 TEST(StaticRuntime, autogen_glu) {
5766 const std::string script = R"IR(
5767 graph(%self: Tensor, %dim: int):
5768 %bias: None = prim::Constant()
5769 %ret = aten::glu(%self, %dim)
5770 %cloned = aten::clone(%ret, %bias)
5771 return (%cloned)
5772 )IR";
5773
5774 auto self0 = at::rand({6, 6, 6});
5775 auto dim0 = 1;
5776 std::vector<IValue> args{self0, dim0};
5777 testStaticRuntime(
5778 script,
5779 args,
5780 {},
5781 /*use_allclose=*/false,
5782 /*use_equalnan=*/false,
5783 /*check_resize=*/true);
5784
5785 auto self1 = at::rand({22, 22, 22});
5786 auto dim1 = 1;
5787 std::vector<IValue> args2{self1, dim1};
5788 testStaticRuntime(
5789 script,
5790 args,
5791 args2,
5792 /*use_allclose=*/false,
5793 /*use_equalnan=*/false,
5794 /*check_resize=*/true);
5795 }
5796
TEST(StaticRuntime,autogen_hardsigmoid)5797 TEST(StaticRuntime, autogen_hardsigmoid) {
5798 const std::string script = R"IR(
5799 graph(%self: Tensor):
5800 %bias: None = prim::Constant()
5801 %ret = aten::hardsigmoid(%self)
5802 %cloned = aten::clone(%ret, %bias)
5803 return (%cloned)
5804 )IR";
5805
5806 auto self0 = at::rand({6, 6, 6});
5807 std::vector<IValue> args{self0};
5808 testStaticRuntime(
5809 script,
5810 args,
5811 {},
5812 /*use_allclose=*/false,
5813 /*use_equalnan=*/false,
5814 /*check_resize=*/true);
5815
5816 auto self1 = at::rand({22, 22, 22});
5817 std::vector<IValue> args2{self1};
5818 testStaticRuntime(
5819 script,
5820 args,
5821 args2,
5822 /*use_allclose=*/false,
5823 /*use_equalnan=*/false,
5824 /*check_resize=*/true);
5825 }
5826
TEST(StaticRuntime,autogen_hardsigmoid_backward)5827 TEST(StaticRuntime, autogen_hardsigmoid_backward) {
5828 const std::string script = R"IR(
5829 graph(%grad_output: Tensor, %self: Tensor):
5830 %bias: None = prim::Constant()
5831 %ret = aten::hardsigmoid_backward(%grad_output, %self)
5832 %cloned = aten::clone(%ret, %bias)
5833 return (%cloned)
5834 )IR";
5835
5836 auto grad_output0 = at::rand({6, 6, 6});
5837 auto self0 = at::rand({6, 6, 6});
5838 std::vector<IValue> args{grad_output0, self0};
5839 testStaticRuntime(
5840 script,
5841 args,
5842 {},
5843 /*use_allclose=*/false,
5844 /*use_equalnan=*/false,
5845 /*check_resize=*/true);
5846
5847 auto grad_output1 = at::rand({22, 22, 22});
5848 auto self1 = at::rand({22, 22, 22});
5849 std::vector<IValue> args2{grad_output1, self1};
5850 testStaticRuntime(
5851 script,
5852 args,
5853 args2,
5854 /*use_allclose=*/false,
5855 /*use_equalnan=*/false,
5856 /*check_resize=*/true);
5857 }
5858
TEST(StaticRuntime,autogen_hardtanh)5859 TEST(StaticRuntime, autogen_hardtanh) {
5860 const std::string script = R"IR(
5861 graph(%self: Tensor, %min_val: int, %max_val: int):
5862 %bias: None = prim::Constant()
5863 %ret = aten::hardtanh(%self, %min_val, %max_val)
5864 %cloned = aten::clone(%ret, %bias)
5865 return (%cloned)
5866 )IR";
5867
5868 auto self0 = at::rand({6, 6, 6});
5869 auto min_val0 = 2;
5870 auto max_val0 = 2;
5871 std::vector<IValue> args{self0, min_val0, max_val0};
5872 testStaticRuntime(
5873 script,
5874 args,
5875 {},
5876 /*use_allclose=*/false,
5877 /*use_equalnan=*/false,
5878 /*check_resize=*/true);
5879
5880 auto self1 = at::rand({22, 22, 22});
5881 auto min_val1 = 2;
5882 auto max_val1 = 2;
5883 std::vector<IValue> args2{self1, min_val1, max_val1};
5884 testStaticRuntime(
5885 script,
5886 args,
5887 args2,
5888 /*use_allclose=*/false,
5889 /*use_equalnan=*/false,
5890 /*check_resize=*/true);
5891 }
5892
TEST(StaticRuntime,autogen_hardswish)5893 TEST(StaticRuntime, autogen_hardswish) {
5894 const std::string script = R"IR(
5895 graph(%self: Tensor):
5896 %bias: None = prim::Constant()
5897 %ret = aten::hardswish(%self)
5898 %cloned = aten::clone(%ret, %bias)
5899 return (%cloned)
5900 )IR";
5901
5902 auto self0 = at::rand({6, 6, 6});
5903 std::vector<IValue> args{self0};
5904 testStaticRuntime(
5905 script,
5906 args,
5907 {},
5908 /*use_allclose=*/false,
5909 /*use_equalnan=*/false,
5910 /*check_resize=*/true);
5911
5912 auto self1 = at::rand({22, 22, 22});
5913 std::vector<IValue> args2{self1};
5914 testStaticRuntime(
5915 script,
5916 args,
5917 args2,
5918 /*use_allclose=*/false,
5919 /*use_equalnan=*/false,
5920 /*check_resize=*/true);
5921 }
5922
TEST(StaticRuntime,autogen_leaky_relu_backward)5923 TEST(StaticRuntime, autogen_leaky_relu_backward) {
5924 const std::string script = R"IR(
5925 graph(%grad_output: Tensor, %self: Tensor, %negative_slope: int, %self_is_result: bool):
5926 %bias: None = prim::Constant()
5927 %ret = aten::leaky_relu_backward(%grad_output, %self, %negative_slope, %self_is_result)
5928 %cloned = aten::clone(%ret, %bias)
5929 return (%cloned)
5930 )IR";
5931
5932 auto grad_output0 = at::rand({6, 6, 6});
5933 auto self0 = at::rand({6, 6, 6});
5934 auto negative_slope0 = 2;
5935 auto self_is_result0 = false;
5936 std::vector<IValue> args{
5937 grad_output0, self0, negative_slope0, self_is_result0};
5938 testStaticRuntime(
5939 script,
5940 args,
5941 {},
5942 /*use_allclose=*/false,
5943 /*use_equalnan=*/false,
5944 /*check_resize=*/true);
5945
5946 auto grad_output1 = at::rand({22, 22, 22});
5947 auto self1 = at::rand({22, 22, 22});
5948 auto negative_slope1 = 2;
5949 auto self_is_result1 = false;
5950 std::vector<IValue> args2{
5951 grad_output1, self1, negative_slope1, self_is_result1};
5952 testStaticRuntime(
5953 script,
5954 args,
5955 args2,
5956 /*use_allclose=*/false,
5957 /*use_equalnan=*/false,
5958 /*check_resize=*/true);
5959 }
5960
TEST(StaticRuntime,autogen_log_sigmoid)5961 TEST(StaticRuntime, autogen_log_sigmoid) {
5962 const std::string script = R"IR(
5963 graph(%self: Tensor):
5964 %bias: None = prim::Constant()
5965 %ret = aten::log_sigmoid(%self)
5966 %cloned = aten::clone(%ret, %bias)
5967 return (%cloned)
5968 )IR";
5969
5970 auto self0 = at::rand({6, 6, 6});
5971 std::vector<IValue> args{self0};
5972 testStaticRuntime(
5973 script,
5974 args,
5975 {},
5976 /*use_allclose=*/false,
5977 /*use_equalnan=*/false,
5978 /*check_resize=*/true);
5979
5980 auto self1 = at::rand({22, 22, 22});
5981 std::vector<IValue> args2{self1};
5982 testStaticRuntime(
5983 script,
5984 args,
5985 args2,
5986 /*use_allclose=*/false,
5987 /*use_equalnan=*/false,
5988 /*check_resize=*/true);
5989 }
5990
TEST(StaticRuntime,autogen_softplus)5991 TEST(StaticRuntime, autogen_softplus) {
5992 const std::string script = R"IR(
5993 graph(%self: Tensor, %beta: int, %threshold: int):
5994 %bias: None = prim::Constant()
5995 %ret = aten::softplus(%self, %beta, %threshold)
5996 %cloned = aten::clone(%ret, %bias)
5997 return (%cloned)
5998 )IR";
5999
6000 auto self0 = at::rand({6, 6, 6});
6001 auto beta0 = 2;
6002 auto threshold0 = 2;
6003 std::vector<IValue> args{self0, beta0, threshold0};
6004 testStaticRuntime(
6005 script,
6006 args,
6007 {},
6008 /*use_allclose=*/false,
6009 /*use_equalnan=*/false,
6010 /*check_resize=*/true);
6011
6012 auto self1 = at::rand({22, 22, 22});
6013 auto beta1 = 2;
6014 auto threshold1 = 2;
6015 std::vector<IValue> args2{self1, beta1, threshold1};
6016 testStaticRuntime(
6017 script,
6018 args,
6019 args2,
6020 /*use_allclose=*/false,
6021 /*use_equalnan=*/false,
6022 /*check_resize=*/true);
6023 }
6024
TEST(StaticRuntime,autogen_softplus_backward)6025 TEST(StaticRuntime, autogen_softplus_backward) {
6026 const std::string script = R"IR(
6027 graph(%grad_output: Tensor, %self: Tensor, %beta: int, %threshold: int):
6028 %bias: None = prim::Constant()
6029 %ret = aten::softplus_backward(%grad_output, %self, %beta, %threshold)
6030 %cloned = aten::clone(%ret, %bias)
6031 return (%cloned)
6032 )IR";
6033
6034 auto grad_output0 = at::rand({6, 6, 6});
6035 auto self0 = at::rand({6, 6, 6});
6036 auto beta0 = 2;
6037 auto threshold0 = 2;
6038 std::vector<IValue> args{grad_output0, self0, beta0, threshold0};
6039 testStaticRuntime(
6040 script,
6041 args,
6042 {},
6043 /*use_allclose=*/false,
6044 /*use_equalnan=*/false,
6045 /*check_resize=*/true);
6046
6047 auto grad_output1 = at::rand({22, 22, 22});
6048 auto self1 = at::rand({22, 22, 22});
6049 auto beta1 = 2;
6050 auto threshold1 = 2;
6051 std::vector<IValue> args2{grad_output1, self1, beta1, threshold1};
6052 testStaticRuntime(
6053 script,
6054 args,
6055 args2,
6056 /*use_allclose=*/false,
6057 /*use_equalnan=*/false,
6058 /*check_resize=*/true);
6059 }
6060
TEST(StaticRuntime,autogen_softshrink)6061 TEST(StaticRuntime, autogen_softshrink) {
6062 const std::string script = R"IR(
6063 graph(%self: Tensor, %lambd: int):
6064 %bias: None = prim::Constant()
6065 %ret = aten::softshrink(%self, %lambd)
6066 %cloned = aten::clone(%ret, %bias)
6067 return (%cloned)
6068 )IR";
6069
6070 auto self0 = at::rand({6, 6, 6});
6071 auto lambd0 = 2;
6072 std::vector<IValue> args{self0, lambd0};
6073 testStaticRuntime(
6074 script,
6075 args,
6076 {},
6077 /*use_allclose=*/false,
6078 /*use_equalnan=*/false,
6079 /*check_resize=*/true);
6080
6081 auto self1 = at::rand({22, 22, 22});
6082 auto lambd1 = 2;
6083 std::vector<IValue> args2{self1, lambd1};
6084 testStaticRuntime(
6085 script,
6086 args,
6087 args2,
6088 /*use_allclose=*/false,
6089 /*use_equalnan=*/false,
6090 /*check_resize=*/true);
6091 }
6092
TEST(StaticRuntime,autogen_softshrink_backward)6093 TEST(StaticRuntime, autogen_softshrink_backward) {
6094 const std::string script = R"IR(
6095 graph(%grad_output: Tensor, %self: Tensor, %lambd: int):
6096 %bias: None = prim::Constant()
6097 %ret = aten::softshrink_backward(%grad_output, %self, %lambd)
6098 %cloned = aten::clone(%ret, %bias)
6099 return (%cloned)
6100 )IR";
6101
6102 auto grad_output0 = at::rand({6, 6, 6});
6103 auto self0 = at::rand({6, 6, 6});
6104 auto lambd0 = 2;
6105 std::vector<IValue> args{grad_output0, self0, lambd0};
6106 testStaticRuntime(
6107 script,
6108 args,
6109 {},
6110 /*use_allclose=*/false,
6111 /*use_equalnan=*/false,
6112 /*check_resize=*/true);
6113
6114 auto grad_output1 = at::rand({22, 22, 22});
6115 auto self1 = at::rand({22, 22, 22});
6116 auto lambd1 = 2;
6117 std::vector<IValue> args2{grad_output1, self1, lambd1};
6118 testStaticRuntime(
6119 script,
6120 args,
6121 args2,
6122 /*use_allclose=*/false,
6123 /*use_equalnan=*/false,
6124 /*check_resize=*/true);
6125 }
6126
TEST(StaticRuntime,autogen_adaptive_max_pool2d_backward)6127 TEST(StaticRuntime, autogen_adaptive_max_pool2d_backward) {
6128 const std::string script = R"IR(
6129 graph(%grad_output: Tensor, %self: Tensor, %indices: Tensor):
6130 %bias: None = prim::Constant()
6131 %ret = aten::adaptive_max_pool2d_backward(%grad_output, %self, %indices)
6132 %cloned = aten::clone(%ret, %bias)
6133 return (%cloned)
6134 )IR";
6135
6136 auto grad_output0 = at::rand({2, 2, 2}, at::kFloat);
6137 auto self0 = at::rand({2, 2, 2}, at::kFloat);
6138 auto indices0 = at::randint(0, 1, {2, 2, 2}, at::kLong);
6139 std::vector<IValue> args{grad_output0, self0, indices0};
6140 testStaticRuntime(
6141 script,
6142 args,
6143 {},
6144 /*use_allclose=*/false,
6145 /*use_equalnan=*/false,
6146 /*check_resize=*/true);
6147
6148 auto grad_output1 = at::rand({3, 3, 3}, at::kFloat);
6149 auto self1 = at::rand({3, 3, 3}, at::kFloat);
6150 auto indices1 = at::randint(0, 1, {3, 3, 3}, at::kLong);
6151 std::vector<IValue> args2{grad_output1, self1, indices1};
6152 testStaticRuntime(
6153 script,
6154 args,
6155 args2,
6156 /*use_allclose=*/false,
6157 /*use_equalnan=*/false,
6158 /*check_resize=*/true);
6159 }
6160
TEST(StaticRuntime,autogen_adaptive_max_pool3d_backward)6161 TEST(StaticRuntime, autogen_adaptive_max_pool3d_backward) {
6162 const std::string script = R"IR(
6163 graph(%grad_output: Tensor, %self: Tensor, %indices: Tensor):
6164 %bias: None = prim::Constant()
6165 %ret = aten::adaptive_max_pool3d_backward(%grad_output, %self, %indices)
6166 %cloned = aten::clone(%ret, %bias)
6167 return (%cloned)
6168 )IR";
6169
6170 auto grad_output0 = at::rand({2, 2, 2, 2}, at::kFloat);
6171 auto self0 = at::rand({2, 2, 2, 2}, at::kFloat);
6172 auto indices0 = at::randint(0, 1, {2, 2, 2, 2}, at::kLong);
6173 std::vector<IValue> args{grad_output0, self0, indices0};
6174 testStaticRuntime(
6175 script,
6176 args,
6177 {},
6178 /*use_allclose=*/false,
6179 /*use_equalnan=*/false,
6180 /*check_resize=*/true);
6181
6182 auto grad_output1 = at::rand({3, 3, 3, 3}, at::kFloat);
6183 auto self1 = at::rand({3, 3, 3, 3}, at::kFloat);
6184 auto indices1 = at::randint(0, 1, {3, 3, 3, 3}, at::kLong);
6185 std::vector<IValue> args2{grad_output1, self1, indices1};
6186 testStaticRuntime(
6187 script,
6188 args,
6189 args2,
6190 /*use_allclose=*/false,
6191 /*use_equalnan=*/false,
6192 /*check_resize=*/true);
6193 }
6194
TEST(StaticRuntime,autogen_sigmoid_backward)6195 TEST(StaticRuntime, autogen_sigmoid_backward) {
6196 const std::string script = R"IR(
6197 graph(%grad_output: Tensor, %output: Tensor):
6198 %bias: None = prim::Constant()
6199 %ret = aten::sigmoid_backward(%grad_output, %output)
6200 %cloned = aten::clone(%ret, %bias)
6201 return (%cloned)
6202 )IR";
6203
6204 auto grad_output0 = at::rand({6, 6, 6});
6205 auto output0 = at::rand({6, 6, 6});
6206 std::vector<IValue> args{grad_output0, output0};
6207 testStaticRuntime(
6208 script,
6209 args,
6210 {},
6211 /*use_allclose=*/false,
6212 /*use_equalnan=*/false,
6213 /*check_resize=*/true);
6214
6215 auto grad_output1 = at::rand({22, 22, 22});
6216 auto output1 = at::rand({22, 22, 22});
6217 std::vector<IValue> args2{grad_output1, output1};
6218 testStaticRuntime(
6219 script,
6220 args,
6221 args2,
6222 /*use_allclose=*/false,
6223 /*use_equalnan=*/false,
6224 /*check_resize=*/true);
6225 }
6226
TEST(StaticRuntime,autogen_tanh_backward)6227 TEST(StaticRuntime, autogen_tanh_backward) {
6228 const std::string script = R"IR(
6229 graph(%grad_output: Tensor, %output: Tensor):
6230 %bias: None = prim::Constant()
6231 %ret = aten::tanh_backward(%grad_output, %output)
6232 %cloned = aten::clone(%ret, %bias)
6233 return (%cloned)
6234 )IR";
6235
6236 auto grad_output0 = at::rand({6, 6, 6});
6237 auto output0 = at::rand({6, 6, 6});
6238 std::vector<IValue> args{grad_output0, output0};
6239 testStaticRuntime(
6240 script,
6241 args,
6242 {},
6243 /*use_allclose=*/false,
6244 /*use_equalnan=*/false,
6245 /*check_resize=*/true);
6246
6247 auto grad_output1 = at::rand({22, 22, 22});
6248 auto output1 = at::rand({22, 22, 22});
6249 std::vector<IValue> args2{grad_output1, output1};
6250 testStaticRuntime(
6251 script,
6252 args,
6253 args2,
6254 /*use_allclose=*/false,
6255 /*use_equalnan=*/false,
6256 /*check_resize=*/true);
6257 }
6258
TEST(StaticRuntime,autogen_isposinf)6259 TEST(StaticRuntime, autogen_isposinf) {
6260 const std::string script = R"IR(
6261 graph(%self: Tensor):
6262 %bias: None = prim::Constant()
6263 %ret = aten::isposinf(%self)
6264 %cloned = aten::clone(%ret, %bias)
6265 return (%cloned)
6266 )IR";
6267
6268 auto self0 = at::rand({6, 6, 6});
6269 std::vector<IValue> args{self0};
6270 testStaticRuntime(
6271 script,
6272 args,
6273 {},
6274 /*use_allclose=*/false,
6275 /*use_equalnan=*/false,
6276 /*check_resize=*/true);
6277
6278 auto self1 = at::rand({22, 22, 22});
6279 std::vector<IValue> args2{self1};
6280 testStaticRuntime(
6281 script,
6282 args,
6283 args2,
6284 /*use_allclose=*/false,
6285 /*use_equalnan=*/false,
6286 /*check_resize=*/true);
6287 }
6288
TEST(StaticRuntime,autogen_isneginf)6289 TEST(StaticRuntime, autogen_isneginf) {
6290 const std::string script = R"IR(
6291 graph(%self: Tensor):
6292 %bias: None = prim::Constant()
6293 %ret = aten::isneginf(%self)
6294 %cloned = aten::clone(%ret, %bias)
6295 return (%cloned)
6296 )IR";
6297
6298 auto self0 = at::rand({6, 6, 6});
6299 std::vector<IValue> args{self0};
6300 testStaticRuntime(
6301 script,
6302 args,
6303 {},
6304 /*use_allclose=*/false,
6305 /*use_equalnan=*/false,
6306 /*check_resize=*/true);
6307
6308 auto self1 = at::rand({22, 22, 22});
6309 std::vector<IValue> args2{self1};
6310 testStaticRuntime(
6311 script,
6312 args,
6313 args2,
6314 /*use_allclose=*/false,
6315 /*use_equalnan=*/false,
6316 /*check_resize=*/true);
6317 }
6318
TEST(StaticRuntime,autogen_special_entr)6319 TEST(StaticRuntime, autogen_special_entr) {
6320 const std::string script = R"IR(
6321 graph(%self: Tensor):
6322 %bias: None = prim::Constant()
6323 %ret = aten::special_entr(%self)
6324 %cloned = aten::clone(%ret, %bias)
6325 return (%cloned)
6326 )IR";
6327
6328 auto self0 = at::rand({6, 6, 6});
6329 std::vector<IValue> args{self0};
6330 testStaticRuntime(
6331 script,
6332 args,
6333 {},
6334 /*use_allclose=*/false,
6335 /*use_equalnan=*/false,
6336 /*check_resize=*/true);
6337
6338 auto self1 = at::rand({22, 22, 22});
6339 std::vector<IValue> args2{self1};
6340 testStaticRuntime(
6341 script,
6342 args,
6343 args2,
6344 /*use_allclose=*/false,
6345 /*use_equalnan=*/false,
6346 /*check_resize=*/true);
6347 }
6348
TEST(StaticRuntime,autogen_special_ndtri)6349 TEST(StaticRuntime, autogen_special_ndtri) {
6350 const std::string script = R"IR(
6351 graph(%self: Tensor):
6352 %bias: None = prim::Constant()
6353 %ret = aten::special_ndtri(%self)
6354 %cloned = aten::clone(%ret, %bias)
6355 return (%cloned)
6356 )IR";
6357
6358 auto self0 = at::rand({6, 6, 6});
6359 std::vector<IValue> args{self0};
6360 testStaticRuntime(
6361 script,
6362 args,
6363 {},
6364 /*use_allclose=*/false,
6365 /*use_equalnan=*/false,
6366 /*check_resize=*/true);
6367
6368 auto self1 = at::rand({22, 22, 22});
6369 std::vector<IValue> args2{self1};
6370 testStaticRuntime(
6371 script,
6372 args,
6373 args2,
6374 /*use_allclose=*/false,
6375 /*use_equalnan=*/false,
6376 /*check_resize=*/true);
6377 }
6378
TEST(StaticRuntime,autogen_special_log_ndtr)6379 TEST(StaticRuntime, autogen_special_log_ndtr) {
6380 const std::string script = R"IR(
6381 graph(%self: Tensor):
6382 %bias: None = prim::Constant()
6383 %ret = aten::special_log_ndtr(%self)
6384 %cloned = aten::clone(%ret, %bias)
6385 return (%cloned)
6386 )IR";
6387
6388 auto self0 = at::rand({6, 6, 6});
6389 std::vector<IValue> args{self0};
6390 testStaticRuntime(
6391 script,
6392 args,
6393 {},
6394 /*use_allclose=*/false,
6395 /*use_equalnan=*/false,
6396 /*check_resize=*/true);
6397
6398 auto self1 = at::rand({22, 22, 22});
6399 std::vector<IValue> args2{self1};
6400 testStaticRuntime(
6401 script,
6402 args,
6403 args2,
6404 /*use_allclose=*/false,
6405 /*use_equalnan=*/false,
6406 /*check_resize=*/true);
6407 }
6408
TEST(StaticRuntime,autogen_special_expm1)6409 TEST(StaticRuntime, autogen_special_expm1) {
6410 const std::string script = R"IR(
6411 graph(%self: Tensor):
6412 %bias: None = prim::Constant()
6413 %ret = aten::special_expm1(%self)
6414 %cloned = aten::clone(%ret, %bias)
6415 return (%cloned)
6416 )IR";
6417
6418 auto self0 = at::rand({6, 6, 6});
6419 std::vector<IValue> args{self0};
6420 testStaticRuntime(
6421 script,
6422 args,
6423 {},
6424 /*use_allclose=*/false,
6425 /*use_equalnan=*/false,
6426 /*check_resize=*/true);
6427
6428 auto self1 = at::rand({22, 22, 22});
6429 std::vector<IValue> args2{self1};
6430 testStaticRuntime(
6431 script,
6432 args,
6433 args2,
6434 /*use_allclose=*/false,
6435 /*use_equalnan=*/false,
6436 /*check_resize=*/true);
6437 }
6438
TEST(StaticRuntime,autogen_special_exp2)6439 TEST(StaticRuntime, autogen_special_exp2) {
6440 const std::string script = R"IR(
6441 graph(%self: Tensor):
6442 %bias: None = prim::Constant()
6443 %ret = aten::special_exp2(%self)
6444 %cloned = aten::clone(%ret, %bias)
6445 return (%cloned)
6446 )IR";
6447
6448 auto self0 = at::rand({6, 6, 6});
6449 std::vector<IValue> args{self0};
6450 testStaticRuntime(
6451 script,
6452 args,
6453 {},
6454 /*use_allclose=*/false,
6455 /*use_equalnan=*/false,
6456 /*check_resize=*/true);
6457
6458 auto self1 = at::rand({22, 22, 22});
6459 std::vector<IValue> args2{self1};
6460 testStaticRuntime(
6461 script,
6462 args,
6463 args2,
6464 /*use_allclose=*/false,
6465 /*use_equalnan=*/false,
6466 /*check_resize=*/true);
6467 }
6468
TEST(StaticRuntime,autogen_special_psi)6469 TEST(StaticRuntime, autogen_special_psi) {
6470 const std::string script = R"IR(
6471 graph(%self: Tensor):
6472 %bias: None = prim::Constant()
6473 %ret = aten::special_psi(%self)
6474 %cloned = aten::clone(%ret, %bias)
6475 return (%cloned)
6476 )IR";
6477
6478 auto self0 = at::rand({6, 6, 6});
6479 std::vector<IValue> args{self0};
6480 testStaticRuntime(
6481 script,
6482 args,
6483 {},
6484 /*use_allclose=*/false,
6485 /*use_equalnan=*/false,
6486 /*check_resize=*/true);
6487
6488 auto self1 = at::rand({22, 22, 22});
6489 std::vector<IValue> args2{self1};
6490 testStaticRuntime(
6491 script,
6492 args,
6493 args2,
6494 /*use_allclose=*/false,
6495 /*use_equalnan=*/false,
6496 /*check_resize=*/true);
6497 }
6498
TEST(StaticRuntime,autogen_special_digamma)6499 TEST(StaticRuntime, autogen_special_digamma) {
6500 const std::string script = R"IR(
6501 graph(%self: Tensor):
6502 %bias: None = prim::Constant()
6503 %ret = aten::special_digamma(%self)
6504 %cloned = aten::clone(%ret, %bias)
6505 return (%cloned)
6506 )IR";
6507
6508 auto self0 = at::rand({6, 6, 6});
6509 std::vector<IValue> args{self0};
6510 testStaticRuntime(
6511 script,
6512 args,
6513 {},
6514 /*use_allclose=*/false,
6515 /*use_equalnan=*/false,
6516 /*check_resize=*/true);
6517
6518 auto self1 = at::rand({22, 22, 22});
6519 std::vector<IValue> args2{self1};
6520 testStaticRuntime(
6521 script,
6522 args,
6523 args2,
6524 /*use_allclose=*/false,
6525 /*use_equalnan=*/false,
6526 /*check_resize=*/true);
6527 }
6528
TEST(StaticRuntime,autogen_special_gammaln)6529 TEST(StaticRuntime, autogen_special_gammaln) {
6530 const std::string script = R"IR(
6531 graph(%self: Tensor):
6532 %bias: None = prim::Constant()
6533 %ret = aten::special_gammaln(%self)
6534 %cloned = aten::clone(%ret, %bias)
6535 return (%cloned)
6536 )IR";
6537
6538 auto self0 = at::rand({6, 6, 6});
6539 std::vector<IValue> args{self0};
6540 testStaticRuntime(
6541 script,
6542 args,
6543 {},
6544 /*use_allclose=*/false,
6545 /*use_equalnan=*/false,
6546 /*check_resize=*/true);
6547
6548 auto self1 = at::rand({22, 22, 22});
6549 std::vector<IValue> args2{self1};
6550 testStaticRuntime(
6551 script,
6552 args,
6553 args2,
6554 /*use_allclose=*/false,
6555 /*use_equalnan=*/false,
6556 /*check_resize=*/true);
6557 }
6558
TEST(StaticRuntime,autogen_special_erf)6559 TEST(StaticRuntime, autogen_special_erf) {
6560 const std::string script = R"IR(
6561 graph(%self: Tensor):
6562 %bias: None = prim::Constant()
6563 %ret = aten::special_erf(%self)
6564 %cloned = aten::clone(%ret, %bias)
6565 return (%cloned)
6566 )IR";
6567
6568 auto self0 = at::rand({6, 6, 6});
6569 std::vector<IValue> args{self0};
6570 testStaticRuntime(
6571 script,
6572 args,
6573 {},
6574 /*use_allclose=*/false,
6575 /*use_equalnan=*/false,
6576 /*check_resize=*/true);
6577
6578 auto self1 = at::rand({22, 22, 22});
6579 std::vector<IValue> args2{self1};
6580 testStaticRuntime(
6581 script,
6582 args,
6583 args2,
6584 /*use_allclose=*/false,
6585 /*use_equalnan=*/false,
6586 /*check_resize=*/true);
6587 }
6588
TEST(StaticRuntime,autogen_special_erfc)6589 TEST(StaticRuntime, autogen_special_erfc) {
6590 const std::string script = R"IR(
6591 graph(%self: Tensor):
6592 %bias: None = prim::Constant()
6593 %ret = aten::special_erfc(%self)
6594 %cloned = aten::clone(%ret, %bias)
6595 return (%cloned)
6596 )IR";
6597
6598 auto self0 = at::rand({6, 6, 6});
6599 std::vector<IValue> args{self0};
6600 testStaticRuntime(
6601 script,
6602 args,
6603 {},
6604 /*use_allclose=*/false,
6605 /*use_equalnan=*/false,
6606 /*check_resize=*/true);
6607
6608 auto self1 = at::rand({22, 22, 22});
6609 std::vector<IValue> args2{self1};
6610 testStaticRuntime(
6611 script,
6612 args,
6613 args2,
6614 /*use_allclose=*/false,
6615 /*use_equalnan=*/false,
6616 /*check_resize=*/true);
6617 }
6618
TEST(StaticRuntime,autogen_special_erfcx)6619 TEST(StaticRuntime, autogen_special_erfcx) {
6620 const std::string script = R"IR(
6621 graph(%self: Tensor):
6622 %bias: None = prim::Constant()
6623 %ret = aten::special_erfcx(%self)
6624 %cloned = aten::clone(%ret, %bias)
6625 return (%cloned)
6626 )IR";
6627
6628 auto self0 = at::rand({6, 6, 6});
6629 std::vector<IValue> args{self0};
6630 testStaticRuntime(
6631 script,
6632 args,
6633 {},
6634 /*use_allclose=*/false,
6635 /*use_equalnan=*/false,
6636 /*check_resize=*/true);
6637
6638 auto self1 = at::rand({22, 22, 22});
6639 std::vector<IValue> args2{self1};
6640 testStaticRuntime(
6641 script,
6642 args,
6643 args2,
6644 /*use_allclose=*/false,
6645 /*use_equalnan=*/false,
6646 /*check_resize=*/true);
6647 }
6648
TEST(StaticRuntime,autogen_special_erfinv)6649 TEST(StaticRuntime, autogen_special_erfinv) {
6650 const std::string script = R"IR(
6651 graph(%self: Tensor):
6652 %bias: None = prim::Constant()
6653 %ret = aten::special_erfinv(%self)
6654 %cloned = aten::clone(%ret, %bias)
6655 return (%cloned)
6656 )IR";
6657
6658 auto self0 = at::rand({6, 6, 6});
6659 std::vector<IValue> args{self0};
6660 testStaticRuntime(
6661 script,
6662 args,
6663 {},
6664 /*use_allclose=*/false,
6665 /*use_equalnan=*/false,
6666 /*check_resize=*/true);
6667
6668 auto self1 = at::rand({22, 22, 22});
6669 std::vector<IValue> args2{self1};
6670 testStaticRuntime(
6671 script,
6672 args,
6673 args2,
6674 /*use_allclose=*/false,
6675 /*use_equalnan=*/false,
6676 /*check_resize=*/true);
6677 }
6678
TEST(StaticRuntime,autogen_special_ndtr)6679 TEST(StaticRuntime, autogen_special_ndtr) {
6680 const std::string script = R"IR(
6681 graph(%self: Tensor):
6682 %bias: None = prim::Constant()
6683 %ret = aten::special_ndtr(%self)
6684 %cloned = aten::clone(%ret, %bias)
6685 return (%cloned)
6686 )IR";
6687
6688 auto self0 = at::rand({6, 6, 6});
6689 std::vector<IValue> args{self0};
6690 testStaticRuntime(
6691 script,
6692 args,
6693 {},
6694 /*use_allclose=*/false,
6695 /*use_equalnan=*/false,
6696 /*check_resize=*/true);
6697
6698 auto self1 = at::rand({22, 22, 22});
6699 std::vector<IValue> args2{self1};
6700 testStaticRuntime(
6701 script,
6702 args,
6703 args2,
6704 /*use_allclose=*/false,
6705 /*use_equalnan=*/false,
6706 /*check_resize=*/true);
6707 }
6708
TEST(StaticRuntime,autogen_special_xlog1py)6709 TEST(StaticRuntime, autogen_special_xlog1py) {
6710 const std::string script = R"IR(
6711 graph(%self: Tensor, %other: Tensor):
6712 %bias: None = prim::Constant()
6713 %ret = aten::special_xlog1py(%self, %other)
6714 %cloned = aten::clone(%ret, %bias)
6715 return (%cloned)
6716 )IR";
6717
6718 auto self0 = at::rand({6, 6, 6});
6719 auto other0 = at::rand({6, 6, 6});
6720 std::vector<IValue> args{self0, other0};
6721 testStaticRuntime(
6722 script,
6723 args,
6724 {},
6725 /*use_allclose=*/false,
6726 /*use_equalnan=*/false,
6727 /*check_resize=*/true);
6728
6729 auto self1 = at::rand({22, 22, 22});
6730 auto other1 = at::rand({22, 22, 22});
6731 std::vector<IValue> args2{self1, other1};
6732 testStaticRuntime(
6733 script,
6734 args,
6735 args2,
6736 /*use_allclose=*/false,
6737 /*use_equalnan=*/false,
6738 /*check_resize=*/true);
6739 }
6740
TEST(StaticRuntime,autogen_special_xlogy)6741 TEST(StaticRuntime, autogen_special_xlogy) {
6742 const std::string script = R"IR(
6743 graph(%self: Tensor, %other: Tensor):
6744 %bias: None = prim::Constant()
6745 %ret = aten::special_xlogy(%self, %other)
6746 %cloned = aten::clone(%ret, %bias)
6747 return (%cloned)
6748 )IR";
6749
6750 auto self0 = at::rand({6, 6, 6});
6751 auto other0 = at::rand({6, 6, 6});
6752 std::vector<IValue> args{self0, other0};
6753 testStaticRuntime(
6754 script,
6755 args,
6756 {},
6757 /*use_allclose=*/false,
6758 /*use_equalnan=*/false,
6759 /*check_resize=*/true);
6760
6761 auto self1 = at::rand({22, 22, 22});
6762 auto other1 = at::rand({22, 22, 22});
6763 std::vector<IValue> args2{self1, other1};
6764 testStaticRuntime(
6765 script,
6766 args,
6767 args2,
6768 /*use_allclose=*/false,
6769 /*use_equalnan=*/false,
6770 /*check_resize=*/true);
6771 }
6772
TEST(StaticRuntime,autogen_special_zeta)6773 TEST(StaticRuntime, autogen_special_zeta) {
6774 const std::string script = R"IR(
6775 graph(%self: Tensor, %other: Tensor):
6776 %bias: None = prim::Constant()
6777 %ret = aten::special_zeta(%self, %other)
6778 %cloned = aten::clone(%ret, %bias)
6779 return (%cloned)
6780 )IR";
6781
6782 auto self0 = at::rand({2, 2, 2}, at::kDouble) + at::ones({2, 2, 2});
6783 auto other0 = at::rand({2, 2, 2}, at::kDouble) + at::ones({2, 2, 2});
6784 std::vector<IValue> args{self0, other0};
6785 testStaticRuntime(
6786 script,
6787 args,
6788 {},
6789 /*use_allclose=*/false,
6790 /*use_equalnan=*/false,
6791 /*check_resize=*/true);
6792
6793 auto self1 = at::rand({5, 5, 5}, at::kDouble) + at::ones({5, 5, 5});
6794 auto other1 = at::rand({5, 5, 5}, at::kDouble) + at::ones({5, 5, 5});
6795 std::vector<IValue> args2{self1, other1};
6796 testStaticRuntime(
6797 script,
6798 args,
6799 args2,
6800 /*use_allclose=*/false,
6801 /*use_equalnan=*/false,
6802 /*check_resize=*/true);
6803 }
6804
TEST(StaticRuntime,autogen_special_i0)6805 TEST(StaticRuntime, autogen_special_i0) {
6806 const std::string script = R"IR(
6807 graph(%self: Tensor):
6808 %bias: None = prim::Constant()
6809 %ret = aten::special_i0(%self)
6810 %cloned = aten::clone(%ret, %bias)
6811 return (%cloned)
6812 )IR";
6813
6814 auto self0 = at::rand({6, 6, 6});
6815 std::vector<IValue> args{self0};
6816 testStaticRuntime(
6817 script,
6818 args,
6819 {},
6820 /*use_allclose=*/false,
6821 /*use_equalnan=*/false,
6822 /*check_resize=*/true);
6823
6824 auto self1 = at::rand({22, 22, 22});
6825 std::vector<IValue> args2{self1};
6826 testStaticRuntime(
6827 script,
6828 args,
6829 args2,
6830 /*use_allclose=*/false,
6831 /*use_equalnan=*/false,
6832 /*check_resize=*/true);
6833 }
6834
TEST(StaticRuntime,autogen_special_i0e)6835 TEST(StaticRuntime, autogen_special_i0e) {
6836 const std::string script = R"IR(
6837 graph(%self: Tensor):
6838 %bias: None = prim::Constant()
6839 %ret = aten::special_i0e(%self)
6840 %cloned = aten::clone(%ret, %bias)
6841 return (%cloned)
6842 )IR";
6843
6844 auto self0 = at::rand({6, 6, 6});
6845 std::vector<IValue> args{self0};
6846 testStaticRuntime(
6847 script,
6848 args,
6849 {},
6850 /*use_allclose=*/false,
6851 /*use_equalnan=*/false,
6852 /*check_resize=*/true);
6853
6854 auto self1 = at::rand({22, 22, 22});
6855 std::vector<IValue> args2{self1};
6856 testStaticRuntime(
6857 script,
6858 args,
6859 args2,
6860 /*use_allclose=*/false,
6861 /*use_equalnan=*/false,
6862 /*check_resize=*/true);
6863 }
6864
TEST(StaticRuntime,autogen_special_i1)6865 TEST(StaticRuntime, autogen_special_i1) {
6866 const std::string script = R"IR(
6867 graph(%self: Tensor):
6868 %bias: None = prim::Constant()
6869 %ret = aten::special_i1(%self)
6870 %cloned = aten::clone(%ret, %bias)
6871 return (%cloned)
6872 )IR";
6873
6874 auto self0 = at::rand({6, 6, 6});
6875 std::vector<IValue> args{self0};
6876 testStaticRuntime(
6877 script,
6878 args,
6879 {},
6880 /*use_allclose=*/false,
6881 /*use_equalnan=*/false,
6882 /*check_resize=*/true);
6883
6884 auto self1 = at::rand({22, 22, 22});
6885 std::vector<IValue> args2{self1};
6886 testStaticRuntime(
6887 script,
6888 args,
6889 args2,
6890 /*use_allclose=*/false,
6891 /*use_equalnan=*/false,
6892 /*check_resize=*/true);
6893 }
6894
TEST(StaticRuntime,autogen_special_i1e)6895 TEST(StaticRuntime, autogen_special_i1e) {
6896 const std::string script = R"IR(
6897 graph(%self: Tensor):
6898 %bias: None = prim::Constant()
6899 %ret = aten::special_i1e(%self)
6900 %cloned = aten::clone(%ret, %bias)
6901 return (%cloned)
6902 )IR";
6903
6904 auto self0 = at::rand({6, 6, 6});
6905 std::vector<IValue> args{self0};
6906 testStaticRuntime(
6907 script,
6908 args,
6909 {},
6910 /*use_allclose=*/false,
6911 /*use_equalnan=*/false,
6912 /*check_resize=*/true);
6913
6914 auto self1 = at::rand({22, 22, 22});
6915 std::vector<IValue> args2{self1};
6916 testStaticRuntime(
6917 script,
6918 args,
6919 args2,
6920 /*use_allclose=*/false,
6921 /*use_equalnan=*/false,
6922 /*check_resize=*/true);
6923 }
6924
TEST(StaticRuntime,autogen_special_polygamma)6925 TEST(StaticRuntime, autogen_special_polygamma) {
6926 const std::string script = R"IR(
6927 graph(%n: int, %self: Tensor):
6928 %bias: None = prim::Constant()
6929 %ret = aten::special_polygamma(%n, %self)
6930 %cloned = aten::clone(%ret, %bias)
6931 return (%cloned)
6932 )IR";
6933
6934 auto n0 = 1;
6935 auto self0 = at::rand({6, 6, 6});
6936 std::vector<IValue> args{n0, self0};
6937 testStaticRuntime(
6938 script,
6939 args,
6940 {},
6941 /*use_allclose=*/false,
6942 /*use_equalnan=*/false,
6943 /*check_resize=*/true);
6944
6945 auto n1 = 1;
6946 auto self1 = at::rand({22, 22, 22});
6947 std::vector<IValue> args2{n1, self1};
6948 testStaticRuntime(
6949 script,
6950 args,
6951 args2,
6952 /*use_allclose=*/false,
6953 /*use_equalnan=*/false,
6954 /*check_resize=*/true);
6955 }
6956
TEST(StaticRuntime,autogen_special_expit)6957 TEST(StaticRuntime, autogen_special_expit) {
6958 const std::string script = R"IR(
6959 graph(%self: Tensor):
6960 %bias: None = prim::Constant()
6961 %ret = aten::special_expit(%self)
6962 %cloned = aten::clone(%ret, %bias)
6963 return (%cloned)
6964 )IR";
6965
6966 auto self0 = at::rand({6, 6, 6});
6967 std::vector<IValue> args{self0};
6968 testStaticRuntime(
6969 script,
6970 args,
6971 {},
6972 /*use_allclose=*/false,
6973 /*use_equalnan=*/false,
6974 /*check_resize=*/true);
6975
6976 auto self1 = at::rand({22, 22, 22});
6977 std::vector<IValue> args2{self1};
6978 testStaticRuntime(
6979 script,
6980 args,
6981 args2,
6982 /*use_allclose=*/false,
6983 /*use_equalnan=*/false,
6984 /*check_resize=*/true);
6985 }
6986
TEST(StaticRuntime,autogen_special_sinc)6987 TEST(StaticRuntime, autogen_special_sinc) {
6988 const std::string script = R"IR(
6989 graph(%self: Tensor):
6990 %bias: None = prim::Constant()
6991 %ret = aten::special_sinc(%self)
6992 %cloned = aten::clone(%ret, %bias)
6993 return (%cloned)
6994 )IR";
6995
6996 auto self0 = at::rand({6, 6, 6});
6997 std::vector<IValue> args{self0};
6998 testStaticRuntime(
6999 script,
7000 args,
7001 {},
7002 /*use_allclose=*/false,
7003 /*use_equalnan=*/false,
7004 /*check_resize=*/true);
7005
7006 auto self1 = at::rand({22, 22, 22});
7007 std::vector<IValue> args2{self1};
7008 testStaticRuntime(
7009 script,
7010 args,
7011 args2,
7012 /*use_allclose=*/false,
7013 /*use_equalnan=*/false,
7014 /*check_resize=*/true);
7015 }
7016
TEST(StaticRuntime,autogen_special_round)7017 TEST(StaticRuntime, autogen_special_round) {
7018 const std::string script = R"IR(
7019 graph(%self: Tensor, %decimals: int):
7020 %bias: None = prim::Constant()
7021 %ret = aten::special_round(%self, %decimals)
7022 %cloned = aten::clone(%ret, %bias)
7023 return (%cloned)
7024 )IR";
7025
7026 auto self0 = at::rand({6, 6, 6});
7027 auto decimals0 = 1;
7028 std::vector<IValue> args{self0, decimals0};
7029 testStaticRuntime(
7030 script,
7031 args,
7032 {},
7033 /*use_allclose=*/false,
7034 /*use_equalnan=*/false,
7035 /*check_resize=*/true);
7036
7037 auto self1 = at::rand({22, 22, 22});
7038 auto decimals1 = 1;
7039 std::vector<IValue> args2{self1, decimals1};
7040 testStaticRuntime(
7041 script,
7042 args,
7043 args2,
7044 /*use_allclose=*/false,
7045 /*use_equalnan=*/false,
7046 /*check_resize=*/true);
7047 }
7048
TEST(StaticRuntime,autogen_special_log1p)7049 TEST(StaticRuntime, autogen_special_log1p) {
7050 const std::string script = R"IR(
7051 graph(%self: Tensor):
7052 %bias: None = prim::Constant()
7053 %ret = aten::special_log1p(%self)
7054 %cloned = aten::clone(%ret, %bias)
7055 return (%cloned)
7056 )IR";
7057
7058 auto self0 = at::rand({6, 6, 6});
7059 std::vector<IValue> args{self0};
7060 testStaticRuntime(
7061 script,
7062 args,
7063 {},
7064 /*use_allclose=*/false,
7065 /*use_equalnan=*/false,
7066 /*check_resize=*/true);
7067
7068 auto self1 = at::rand({22, 22, 22});
7069 std::vector<IValue> args2{self1};
7070 testStaticRuntime(
7071 script,
7072 args,
7073 args2,
7074 /*use_allclose=*/false,
7075 /*use_equalnan=*/false,
7076 /*check_resize=*/true);
7077 }
7078
TEST(StaticRuntime,autogen_special_gammainc)7079 TEST(StaticRuntime, autogen_special_gammainc) {
7080 const std::string script = R"IR(
7081 graph(%self: Tensor, %other: Tensor):
7082 %bias: None = prim::Constant()
7083 %ret = aten::special_gammainc(%self, %other)
7084 %cloned = aten::clone(%ret, %bias)
7085 return (%cloned)
7086 )IR";
7087
7088 auto self0 = at::rand({6, 6, 6});
7089 auto other0 = at::rand({6, 6, 6});
7090 std::vector<IValue> args{self0, other0};
7091 testStaticRuntime(
7092 script,
7093 args,
7094 {},
7095 /*use_allclose=*/false,
7096 /*use_equalnan=*/false,
7097 /*check_resize=*/true);
7098
7099 auto self1 = at::rand({22, 22, 22});
7100 auto other1 = at::rand({22, 22, 22});
7101 std::vector<IValue> args2{self1, other1};
7102 testStaticRuntime(
7103 script,
7104 args,
7105 args2,
7106 /*use_allclose=*/false,
7107 /*use_equalnan=*/false,
7108 /*check_resize=*/true);
7109 }
7110
TEST(StaticRuntime,autogen_special_gammaincc)7111 TEST(StaticRuntime, autogen_special_gammaincc) {
7112 const std::string script = R"IR(
7113 graph(%self: Tensor, %other: Tensor):
7114 %bias: None = prim::Constant()
7115 %ret = aten::special_gammaincc(%self, %other)
7116 %cloned = aten::clone(%ret, %bias)
7117 return (%cloned)
7118 )IR";
7119
7120 auto self0 = at::rand({6, 6, 6});
7121 auto other0 = at::rand({6, 6, 6});
7122 std::vector<IValue> args{self0, other0};
7123 testStaticRuntime(
7124 script,
7125 args,
7126 {},
7127 /*use_allclose=*/false,
7128 /*use_equalnan=*/false,
7129 /*check_resize=*/true);
7130
7131 auto self1 = at::rand({22, 22, 22});
7132 auto other1 = at::rand({22, 22, 22});
7133 std::vector<IValue> args2{self1, other1};
7134 testStaticRuntime(
7135 script,
7136 args,
7137 args2,
7138 /*use_allclose=*/false,
7139 /*use_equalnan=*/false,
7140 /*check_resize=*/true);
7141 }
7142
TEST(StaticRuntime,autogen_special_multigammaln)7143 TEST(StaticRuntime, autogen_special_multigammaln) {
7144 const std::string script = R"IR(
7145 graph(%self: Tensor, %p: int):
7146 %bias: None = prim::Constant()
7147 %ret = aten::special_multigammaln(%self, %p)
7148 %cloned = aten::clone(%ret, %bias)
7149 return (%cloned)
7150 )IR";
7151
7152 auto self0 = at::rand({6, 6, 6});
7153 auto p0 = 1;
7154 std::vector<IValue> args{self0, p0};
7155 testStaticRuntime(
7156 script,
7157 args,
7158 {},
7159 /*use_allclose=*/false,
7160 /*use_equalnan=*/false,
7161 /*check_resize=*/true);
7162
7163 auto self1 = at::rand({22, 22, 22});
7164 auto p1 = 1;
7165 std::vector<IValue> args2{self1, p1};
7166 testStaticRuntime(
7167 script,
7168 args,
7169 args2,
7170 /*use_allclose=*/false,
7171 /*use_equalnan=*/false,
7172 /*check_resize=*/true);
7173 }
7174
TEST(StaticRuntime,autogen_linalg_cross)7175 TEST(StaticRuntime, autogen_linalg_cross) {
7176 const std::string script = R"IR(
7177 graph(%self: Tensor, %other: Tensor, %dim: int):
7178 %bias: None = prim::Constant()
7179 %ret = aten::linalg_cross(%self, %other, %dim)
7180 %cloned = aten::clone(%ret, %bias)
7181 return (%cloned)
7182 )IR";
7183
7184 auto self0 = at::rand({6, 3, 6});
7185 auto other0 = at::rand({6, 3, 6});
7186 auto dim0 = 1;
7187 std::vector<IValue> args{self0, other0, dim0};
7188 testStaticRuntime(
7189 script,
7190 args,
7191 {},
7192 /*use_allclose=*/false,
7193 /*use_equalnan=*/false,
7194 /*check_resize=*/true);
7195
7196 auto self1 = at::rand({22, 3, 22});
7197 auto other1 = at::rand({22, 3, 22});
7198 auto dim1 = 1;
7199 std::vector<IValue> args2{self1, other1, dim1};
7200 testStaticRuntime(
7201 script,
7202 args,
7203 args2,
7204 /*use_allclose=*/false,
7205 /*use_equalnan=*/false,
7206 /*check_resize=*/true);
7207 }
7208
TEST(StaticRuntime,autogen_linalg_det)7209 TEST(StaticRuntime, autogen_linalg_det) {
7210 const std::string script = R"IR(
7211 graph(%A: Tensor):
7212 %bias: None = prim::Constant()
7213 %ret = aten::linalg_det(%A)
7214 %cloned = aten::clone(%ret, %bias)
7215 return (%cloned)
7216 )IR";
7217
7218 auto A0 = at::rand({6, 6, 6});
7219 std::vector<IValue> args{A0};
7220 testStaticRuntime(
7221 script,
7222 args,
7223 {},
7224 /*use_allclose=*/false,
7225 /*use_equalnan=*/false,
7226 /*check_resize=*/true);
7227
7228 auto A1 = at::rand({22, 22, 22});
7229 std::vector<IValue> args2{A1};
7230 testStaticRuntime(
7231 script,
7232 args,
7233 args2,
7234 /*use_allclose=*/false,
7235 /*use_equalnan=*/false,
7236 /*check_resize=*/true);
7237 }
7238
TEST(StaticRuntime,autogen_linalg_matmul)7239 TEST(StaticRuntime, autogen_linalg_matmul) {
7240 const std::string script = R"IR(
7241 graph(%self: Tensor, %other: Tensor):
7242 %bias: None = prim::Constant()
7243 %ret = aten::linalg_matmul(%self, %other)
7244 %cloned = aten::clone(%ret, %bias)
7245 return (%cloned)
7246 )IR";
7247
7248 auto self0 = at::rand({6, 6, 6});
7249 auto other0 = at::rand({6, 6, 6});
7250 std::vector<IValue> args{self0, other0};
7251 testStaticRuntime(
7252 script,
7253 args,
7254 {},
7255 /*use_allclose=*/false,
7256 /*use_equalnan=*/false,
7257 /*check_resize=*/true);
7258
7259 auto self1 = at::rand({22, 22, 22});
7260 auto other1 = at::rand({22, 22, 22});
7261 std::vector<IValue> args2{self1, other1};
7262 testStaticRuntime(
7263 script,
7264 args,
7265 args2,
7266 /*use_allclose=*/false,
7267 /*use_equalnan=*/false,
7268 /*check_resize=*/true);
7269 }
7270
TEST(StaticRuntime,autogen_linalg_eigvals)7271 TEST(StaticRuntime, autogen_linalg_eigvals) {
7272 const std::string script = R"IR(
7273 graph(%self: Tensor):
7274 %bias: None = prim::Constant()
7275 %ret = aten::linalg_eigvals(%self)
7276 %cloned = aten::clone(%ret, %bias)
7277 return (%cloned)
7278 )IR";
7279
7280 auto self0 = at::rand({6, 6, 6});
7281 std::vector<IValue> args{self0};
7282 testStaticRuntime(
7283 script,
7284 args,
7285 {},
7286 /*use_allclose=*/false,
7287 /*use_equalnan=*/false,
7288 /*check_resize=*/true);
7289
7290 auto self1 = at::rand({22, 22, 22});
7291 std::vector<IValue> args2{self1};
7292 testStaticRuntime(
7293 script,
7294 args,
7295 args2,
7296 /*use_allclose=*/false,
7297 /*use_equalnan=*/false,
7298 /*check_resize=*/true);
7299 }
7300
TEST(StaticRuntime,autogen_linalg_inv)7301 TEST(StaticRuntime, autogen_linalg_inv) {
7302 const std::string script = R"IR(
7303 graph(%A: Tensor):
7304 %bias: None = prim::Constant()
7305 %ret = aten::linalg_inv(%A)
7306 %cloned = aten::clone(%ret, %bias)
7307 return (%cloned)
7308 )IR";
7309
7310 auto A0 = at::rand({6, 6, 6});
7311 std::vector<IValue> args{A0};
7312 testStaticRuntime(
7313 script,
7314 args,
7315 {},
7316 /*use_allclose=*/false,
7317 /*use_equalnan=*/false,
7318 /*check_resize=*/true);
7319
7320 auto A1 = at::rand({22, 22, 22});
7321 std::vector<IValue> args2{A1};
7322 testStaticRuntime(
7323 script,
7324 args,
7325 args2,
7326 /*use_allclose=*/false,
7327 /*use_equalnan=*/false,
7328 /*check_resize=*/true);
7329 }
7330
TEST(StaticRuntime,autogen_inverse)7331 TEST(StaticRuntime, autogen_inverse) {
7332 const std::string script = R"IR(
7333 graph(%self: Tensor):
7334 %bias: None = prim::Constant()
7335 %ret = aten::inverse(%self)
7336 %cloned = aten::clone(%ret, %bias)
7337 return (%cloned)
7338 )IR";
7339
7340 auto self0 = at::rand({6, 6, 6});
7341 std::vector<IValue> args{self0};
7342 testStaticRuntime(
7343 script,
7344 args,
7345 {},
7346 /*use_allclose=*/false,
7347 /*use_equalnan=*/false,
7348 /*check_resize=*/true);
7349
7350 auto self1 = at::rand({22, 22, 22});
7351 std::vector<IValue> args2{self1};
7352 testStaticRuntime(
7353 script,
7354 args,
7355 args2,
7356 /*use_allclose=*/false,
7357 /*use_equalnan=*/false,
7358 /*check_resize=*/true);
7359 }
7360
TEST(StaticRuntime,autogen_inner)7361 TEST(StaticRuntime, autogen_inner) {
7362 const std::string script = R"IR(
7363 graph(%self: Tensor, %other: Tensor):
7364 %bias: None = prim::Constant()
7365 %ret = aten::inner(%self, %other)
7366 %cloned = aten::clone(%ret, %bias)
7367 return (%cloned)
7368 )IR";
7369
7370 auto self0 = at::rand({6, 6, 6});
7371 auto other0 = at::rand({6, 6, 6});
7372 std::vector<IValue> args{self0, other0};
7373 testStaticRuntime(
7374 script,
7375 args,
7376 {},
7377 /*use_allclose=*/false,
7378 /*use_equalnan=*/false,
7379 /*check_resize=*/true);
7380
7381 auto self1 = at::rand({22, 22, 22});
7382 auto other1 = at::rand({22, 22, 22});
7383 std::vector<IValue> args2{self1, other1};
7384 testStaticRuntime(
7385 script,
7386 args,
7387 args2,
7388 /*use_allclose=*/false,
7389 /*use_equalnan=*/false,
7390 /*check_resize=*/true);
7391 }
7392
TEST(StaticRuntime,autogen_outer)7393 TEST(StaticRuntime, autogen_outer) {
7394 const std::string script = R"IR(
7395 graph(%self: Tensor, %vec2: Tensor):
7396 %bias: None = prim::Constant()
7397 %ret = aten::outer(%self, %vec2)
7398 %cloned = aten::clone(%ret, %bias)
7399 return (%cloned)
7400 )IR";
7401
7402 auto self0 = at::rand({16});
7403 auto vec20 = at::rand({16});
7404 std::vector<IValue> args{self0, vec20};
7405 testStaticRuntime(
7406 script,
7407 args,
7408 {},
7409 /*use_allclose=*/false,
7410 /*use_equalnan=*/false,
7411 /*check_resize=*/true);
7412
7413 auto self1 = at::rand({64});
7414 auto vec21 = at::rand({64});
7415 std::vector<IValue> args2{self1, vec21};
7416 testStaticRuntime(
7417 script,
7418 args,
7419 args2,
7420 /*use_allclose=*/false,
7421 /*use_equalnan=*/false,
7422 /*check_resize=*/true);
7423 }
7424
TEST(StaticRuntime,autogen_linalg_cond)7425 TEST(StaticRuntime, autogen_linalg_cond) {
7426 const std::string script = R"IR(
7427 graph(%self: Tensor, %p: int?):
7428 %bias: None = prim::Constant()
7429 %ret = aten::linalg_cond(%self, %p)
7430 %cloned = aten::clone(%ret, %bias)
7431 return (%cloned)
7432 )IR";
7433
7434 auto self0 = at::rand({6, 6, 6});
7435 auto p0 = 2;
7436 std::vector<IValue> args{self0, p0};
7437 testStaticRuntime(
7438 script,
7439 args,
7440 {},
7441 /*use_allclose=*/false,
7442 /*use_equalnan=*/false,
7443 /*check_resize=*/true);
7444
7445 auto self1 = at::rand({22, 22, 22});
7446 auto p1 = 2;
7447 std::vector<IValue> args2{self1, p1};
7448 testStaticRuntime(
7449 script,
7450 args,
7451 args2,
7452 /*use_allclose=*/false,
7453 /*use_equalnan=*/false,
7454 /*check_resize=*/true);
7455 }
7456
TEST(StaticRuntime,autogen_linalg_solve)7457 TEST(StaticRuntime, autogen_linalg_solve) {
7458 const std::string script = R"IR(
7459 graph(%A: Tensor, %B: Tensor, %left: bool):
7460 %bias: None = prim::Constant()
7461 %ret = aten::linalg_solve(%A, %B, %left)
7462 %cloned = aten::clone(%ret, %bias)
7463 return (%cloned)
7464 )IR";
7465
7466 auto A0 = at::rand({6, 6, 6});
7467 auto B0 = at::rand({6, 6, 6});
7468 auto left0 = false;
7469 std::vector<IValue> args{A0, B0, left0};
7470 testStaticRuntime(
7471 script,
7472 args,
7473 {},
7474 /*use_allclose=*/false,
7475 /*use_equalnan=*/false,
7476 /*check_resize=*/true);
7477
7478 auto A1 = at::rand({22, 22, 22});
7479 auto B1 = at::rand({22, 22, 22});
7480 auto left1 = false;
7481 std::vector<IValue> args2{A1, B1, left1};
7482 testStaticRuntime(
7483 script,
7484 args,
7485 args2,
7486 /*use_allclose=*/false,
7487 /*use_equalnan=*/false,
7488 /*check_resize=*/true);
7489 }
7490
TEST(StaticRuntime,autogen_linalg_tensorinv)7491 TEST(StaticRuntime, autogen_linalg_tensorinv) {
7492 const std::string script = R"IR(
7493 graph(%self: Tensor, %ind: int):
7494 %bias: None = prim::Constant()
7495 %ret = aten::linalg_tensorinv(%self, %ind)
7496 %cloned = aten::clone(%ret, %bias)
7497 return (%cloned)
7498 )IR";
7499
7500 auto self0 = at::rand({6, 6, 6, 6});
7501 auto ind0 = 2;
7502 std::vector<IValue> args{self0, ind0};
7503 testStaticRuntime(
7504 script,
7505 args,
7506 {},
7507 /*use_allclose=*/false,
7508 /*use_equalnan=*/false,
7509 /*check_resize=*/true);
7510
7511 auto self1 = at::rand({22, 22, 22, 22});
7512 auto ind1 = 2;
7513 std::vector<IValue> args2{self1, ind1};
7514 testStaticRuntime(
7515 script,
7516 args,
7517 args2,
7518 /*use_allclose=*/false,
7519 /*use_equalnan=*/false,
7520 /*check_resize=*/true);
7521 }
7522
TEST(StaticRuntime,autogen_linalg_matrix_power)7523 TEST(StaticRuntime, autogen_linalg_matrix_power) {
7524 const std::string script = R"IR(
7525 graph(%self: Tensor, %n: int):
7526 %bias: None = prim::Constant()
7527 %ret = aten::linalg_matrix_power(%self, %n)
7528 %cloned = aten::clone(%ret, %bias)
7529 return (%cloned)
7530 )IR";
7531
7532 auto self0 = at::rand({6, 6, 6});
7533 auto n0 = 1;
7534 std::vector<IValue> args{self0, n0};
7535 testStaticRuntime(
7536 script,
7537 args,
7538 {},
7539 /*use_allclose=*/false,
7540 /*use_equalnan=*/false,
7541 /*check_resize=*/true);
7542
7543 auto self1 = at::rand({22, 22, 22});
7544 auto n1 = 1;
7545 std::vector<IValue> args2{self1, n1};
7546 testStaticRuntime(
7547 script,
7548 args,
7549 args2,
7550 /*use_allclose=*/false,
7551 /*use_equalnan=*/false,
7552 /*check_resize=*/true);
7553 }
7554
TEST(StaticRuntime,autogen_view_as_real)7555 TEST(StaticRuntime, autogen_view_as_real) {
7556 const std::string script = R"IR(
7557 graph(%self: Tensor):
7558 %bias: None = prim::Constant()
7559 %ret = aten::view_as_real(%self)
7560 %cloned = aten::clone(%ret, %bias)
7561 return (%cloned)
7562 )IR";
7563
7564 auto self0 = at::randn({6, 6, 6}, at::kComplexFloat);
7565 std::vector<IValue> args{self0};
7566 testStaticRuntime(script, args);
7567 }
7568
TEST(StaticRuntime,autogen_view_as_complex)7569 TEST(StaticRuntime, autogen_view_as_complex) {
7570 const std::string script = R"IR(
7571 graph(%self: Tensor):
7572 %bias: None = prim::Constant()
7573 %ret = aten::view_as_complex(%self)
7574 %cloned = aten::clone(%ret, %bias)
7575 return (%cloned)
7576 )IR";
7577
7578 auto self0 = at::rand({2, 2});
7579 std::vector<IValue> args{self0};
7580 testStaticRuntime(script, args);
7581 }
7582
TEST(StaticRuntime,autogen_real)7583 TEST(StaticRuntime, autogen_real) {
7584 const std::string script = R"IR(
7585 graph(%self: Tensor):
7586 %bias: None = prim::Constant()
7587 %ret = aten::real(%self)
7588 %cloned = aten::clone(%ret, %bias)
7589 return (%cloned)
7590 )IR";
7591
7592 auto self0 = at::rand({6, 6, 6});
7593 std::vector<IValue> args{self0};
7594 testStaticRuntime(script, args);
7595 }
7596
TEST(StaticRuntime,autogen_imag)7597 TEST(StaticRuntime, autogen_imag) {
7598 const std::string script = R"IR(
7599 graph(%self: Tensor):
7600 %bias: None = prim::Constant()
7601 %ret = aten::imag(%self)
7602 %cloned = aten::clone(%ret, %bias)
7603 return (%cloned)
7604 )IR";
7605
7606 auto self0 = at::randn({6, 6, 6}, at::kComplexFloat);
7607 std::vector<IValue> args{self0};
7608 testStaticRuntime(script, args);
7609 }
7610
TEST(StaticRuntime,autogen__conj)7611 TEST(StaticRuntime, autogen__conj) {
7612 const std::string script = R"IR(
7613 graph(%self: Tensor):
7614 %bias: None = prim::Constant()
7615 %ret = aten::_conj(%self)
7616 %cloned = aten::clone(%ret, %bias)
7617 return (%cloned)
7618 )IR";
7619
7620 auto self0 = at::randn({6, 6, 6}, at::kComplexFloat);
7621 std::vector<IValue> args{self0};
7622 testStaticRuntime(script, args);
7623 }
7624
TEST(StaticRuntime,autogen_conj)7625 TEST(StaticRuntime, autogen_conj) {
7626 const std::string script = R"IR(
7627 graph(%self: Tensor):
7628 %bias: None = prim::Constant()
7629 %ret = aten::conj(%self)
7630 %cloned = aten::clone(%ret, %bias)
7631 return (%cloned)
7632 )IR";
7633
7634 auto self0 = at::rand({6, 6, 6});
7635 std::vector<IValue> args{self0};
7636 testStaticRuntime(script, args);
7637 }
7638
TEST(StaticRuntime,autogen_resolve_conj)7639 TEST(StaticRuntime, autogen_resolve_conj) {
7640 const std::string script = R"IR(
7641 graph(%self: Tensor):
7642 %bias: None = prim::Constant()
7643 %ret = aten::resolve_conj(%self)
7644 %cloned = aten::clone(%ret, %bias)
7645 return (%cloned)
7646 )IR";
7647
7648 auto self0 = at::rand({6, 6, 6});
7649 std::vector<IValue> args{self0};
7650 testStaticRuntime(script, args);
7651 }
7652
TEST(StaticRuntime,autogen_resolve_neg)7653 TEST(StaticRuntime, autogen_resolve_neg) {
7654 const std::string script = R"IR(
7655 graph(%self: Tensor):
7656 %bias: None = prim::Constant()
7657 %ret = aten::resolve_neg(%self)
7658 %cloned = aten::clone(%ret, %bias)
7659 return (%cloned)
7660 )IR";
7661
7662 auto self0 = at::rand({6, 6, 6});
7663 std::vector<IValue> args{self0};
7664 testStaticRuntime(script, args);
7665 }
7666
TEST(StaticRuntime,autogen__neg_view)7667 TEST(StaticRuntime, autogen__neg_view) {
7668 const std::string script = R"IR(
7669 graph(%self: Tensor):
7670 %bias: None = prim::Constant()
7671 %ret = aten::_neg_view(%self)
7672 %cloned = aten::clone(%ret, %bias)
7673 return (%cloned)
7674 )IR";
7675
7676 auto self0 = at::rand({6, 6, 6});
7677 std::vector<IValue> args{self0};
7678 testStaticRuntime(script, args);
7679 }
7680
TEST(StaticRuntime,autogen_diagonal)7681 TEST(StaticRuntime, autogen_diagonal) {
7682 const std::string script = R"IR(
7683 graph(%self: Tensor, %offset: int, %dim1: int, %dim2: int):
7684 %bias: None = prim::Constant()
7685 %ret = aten::diagonal(%self, %offset, %dim1, %dim2)
7686 %cloned = aten::clone(%ret, %bias)
7687 return (%cloned)
7688 )IR";
7689
7690 auto self0 = at::rand({6, 6, 6});
7691 auto offset0 = 0;
7692 auto dim10 = 2;
7693 auto dim20 = 1;
7694 std::vector<IValue> args{self0, offset0, dim10, dim20};
7695 testStaticRuntime(script, args);
7696 }
7697
TEST(StaticRuntime,autogen_linalg_diagonal)7698 TEST(StaticRuntime, autogen_linalg_diagonal) {
7699 const std::string script = R"IR(
7700 graph(%A: Tensor, %offset: int, %dim1: int, %dim2: int):
7701 %bias: None = prim::Constant()
7702 %ret = aten::linalg_diagonal(%A, %offset, %dim1, %dim2)
7703 %cloned = aten::clone(%ret, %bias)
7704 return (%cloned)
7705 )IR";
7706
7707 auto A0 = at::rand({6, 6, 6});
7708 auto offset0 = 0;
7709 auto dim10 = 2;
7710 auto dim20 = 1;
7711 std::vector<IValue> args{A0, offset0, dim10, dim20};
7712 testStaticRuntime(script, args);
7713 }
7714
TEST(StaticRuntime,autogen_movedim_int)7715 TEST(StaticRuntime, autogen_movedim_int) {
7716 const std::string script = R"IR(
7717 graph(%self: Tensor, %source: int, %destination: int):
7718 %bias: None = prim::Constant()
7719 %ret = aten::movedim(%self, %source, %destination)
7720 %cloned = aten::clone(%ret, %bias)
7721 return (%cloned)
7722 )IR";
7723
7724 auto self0 = at::rand({6, 6, 6});
7725 auto source0 = 1;
7726 auto destination0 = 1;
7727 std::vector<IValue> args{self0, source0, destination0};
7728 testStaticRuntime(script, args);
7729 }
7730
TEST(StaticRuntime,autogen_moveaxis_int)7731 TEST(StaticRuntime, autogen_moveaxis_int) {
7732 const std::string script = R"IR(
7733 graph(%self: Tensor, %source: int, %destination: int):
7734 %bias: None = prim::Constant()
7735 %ret = aten::moveaxis(%self, %source, %destination)
7736 %cloned = aten::clone(%ret, %bias)
7737 return (%cloned)
7738 )IR";
7739
7740 auto self0 = at::rand({6, 6, 6});
7741 auto source0 = 1;
7742 auto destination0 = 1;
7743 std::vector<IValue> args{self0, source0, destination0};
7744 testStaticRuntime(script, args);
7745 }
7746
TEST(StaticRuntime,autogen_numpy_T)7747 TEST(StaticRuntime, autogen_numpy_T) {
7748 const std::string script = R"IR(
7749 graph(%self: Tensor):
7750 %bias: None = prim::Constant()
7751 %ret = aten::numpy_T(%self)
7752 %cloned = aten::clone(%ret, %bias)
7753 return (%cloned)
7754 )IR";
7755
7756 auto self0 = at::rand({6, 6, 6});
7757 std::vector<IValue> args{self0};
7758 testStaticRuntime(script, args);
7759 }
7760
TEST(StaticRuntime,autogen_matrix_H)7761 TEST(StaticRuntime, autogen_matrix_H) {
7762 const std::string script = R"IR(
7763 graph(%self: Tensor):
7764 %bias: None = prim::Constant()
7765 %ret = aten::matrix_H(%self)
7766 %cloned = aten::clone(%ret, %bias)
7767 return (%cloned)
7768 )IR";
7769
7770 auto self0 = at::rand({8, 8});
7771 std::vector<IValue> args{self0};
7772 testStaticRuntime(script, args);
7773 }
7774
TEST(StaticRuntime,autogen_mT)7775 TEST(StaticRuntime, autogen_mT) {
7776 const std::string script = R"IR(
7777 graph(%self: Tensor):
7778 %bias: None = prim::Constant()
7779 %ret = aten::mT(%self)
7780 %cloned = aten::clone(%ret, %bias)
7781 return (%cloned)
7782 )IR";
7783
7784 auto self0 = at::rand({6, 6, 6});
7785 std::vector<IValue> args{self0};
7786 testStaticRuntime(script, args);
7787 }
7788
TEST(StaticRuntime,autogen_mH)7789 TEST(StaticRuntime, autogen_mH) {
7790 const std::string script = R"IR(
7791 graph(%self: Tensor):
7792 %bias: None = prim::Constant()
7793 %ret = aten::mH(%self)
7794 %cloned = aten::clone(%ret, %bias)
7795 return (%cloned)
7796 )IR";
7797
7798 auto self0 = at::rand({6, 6, 6});
7799 std::vector<IValue> args{self0};
7800 testStaticRuntime(script, args);
7801 }
7802
TEST(StaticRuntime,autogen_adjoint)7803 TEST(StaticRuntime, autogen_adjoint) {
7804 const std::string script = R"IR(
7805 graph(%self: Tensor):
7806 %bias: None = prim::Constant()
7807 %ret = aten::adjoint(%self)
7808 %cloned = aten::clone(%ret, %bias)
7809 return (%cloned)
7810 )IR";
7811
7812 auto self0 = at::rand({6, 6, 6});
7813 std::vector<IValue> args{self0};
7814 testStaticRuntime(script, args);
7815 }
7816
TEST(StaticRuntime,autogen_ravel)7817 TEST(StaticRuntime, autogen_ravel) {
7818 const std::string script = R"IR(
7819 graph(%self: Tensor):
7820 %bias: None = prim::Constant()
7821 %ret = aten::ravel(%self)
7822 %cloned = aten::clone(%ret, %bias)
7823 return (%cloned)
7824 )IR";
7825
7826 auto self0 = at::rand({6, 6, 6});
7827 std::vector<IValue> args{self0};
7828 testStaticRuntime(script, args);
7829 }
7830
TEST(StaticRuntime,autogen_t)7831 TEST(StaticRuntime, autogen_t) {
7832 const std::string script = R"IR(
7833 graph(%self: Tensor):
7834 %bias: None = prim::Constant()
7835 %ret = aten::t(%self)
7836 %cloned = aten::clone(%ret, %bias)
7837 return (%cloned)
7838 )IR";
7839
7840 auto self0 = at::rand({8, 8});
7841 std::vector<IValue> args{self0};
7842 testStaticRuntime(script, args);
7843 }
7844
TEST(StaticRuntime,autogen_unsqueeze)7845 TEST(StaticRuntime, autogen_unsqueeze) {
7846 const std::string script = R"IR(
7847 graph(%self: Tensor, %dim: int):
7848 %bias: None = prim::Constant()
7849 %ret = aten::unsqueeze(%self, %dim)
7850 %cloned = aten::clone(%ret, %bias)
7851 return (%cloned)
7852 )IR";
7853
7854 auto self0 = at::rand({6, 6, 6});
7855 auto dim0 = 1;
7856 std::vector<IValue> args{self0, dim0};
7857 testStaticRuntime(script, args);
7858 }
7859
TEST(StaticRuntime,autogen_view_as)7860 TEST(StaticRuntime, autogen_view_as) {
7861 const std::string script = R"IR(
7862 graph(%self: Tensor, %other: Tensor):
7863 %bias: None = prim::Constant()
7864 %ret = aten::view_as(%self, %other)
7865 %cloned = aten::clone(%ret, %bias)
7866 return (%cloned)
7867 )IR";
7868
7869 auto self0 = at::rand({6, 6, 6});
7870 auto other0 = at::rand({6, 6, 6});
7871 std::vector<IValue> args{self0, other0};
7872 testStaticRuntime(script, args);
7873 }
7874
TEST(StaticRuntime,autogen_positive)7875 TEST(StaticRuntime, autogen_positive) {
7876 const std::string script = R"IR(
7877 graph(%self: Tensor):
7878 %bias: None = prim::Constant()
7879 %ret = aten::positive(%self)
7880 %cloned = aten::clone(%ret, %bias)
7881 return (%cloned)
7882 )IR";
7883
7884 auto self0 = at::rand({6, 6, 6});
7885 std::vector<IValue> args{self0};
7886 testStaticRuntime(script, args);
7887 }
7888
TEST(StaticRuntime,autogen__autocast_to_reduced_precision)7889 TEST(StaticRuntime, autogen__autocast_to_reduced_precision) {
7890 const std::string script = R"IR(
7891 graph(%self: Tensor, %cuda_enabled: bool, %cpu_enabled: bool, %cuda_dtype: int, %cpu_dtype: int):
7892 %bias: None = prim::Constant()
7893 %ret = aten::_autocast_to_reduced_precision(%self, %cuda_enabled, %cpu_enabled, %cuda_dtype, %cpu_dtype)
7894 %cloned = aten::clone(%ret, %bias)
7895 return (%cloned)
7896 )IR";
7897
7898 auto self0 = at::rand({6, 6, 6});
7899 auto cuda_enabled0 = false;
7900 auto cpu_enabled0 = false;
7901 auto cuda_dtype0 = at::ScalarType::Float;
7902 auto cpu_dtype0 = at::ScalarType::Float;
7903 std::vector<IValue> args{
7904 self0, cuda_enabled0, cpu_enabled0, cuda_dtype0, cpu_dtype0};
7905 testStaticRuntime(script, args);
7906 }
7907
TEST(StaticRuntime,autogen__autocast_to_full_precision)7908 TEST(StaticRuntime, autogen__autocast_to_full_precision) {
7909 const std::string script = R"IR(
7910 graph(%self: Tensor, %cuda_enabled: bool, %cpu_enabled: bool):
7911 %bias: None = prim::Constant()
7912 %ret = aten::_autocast_to_full_precision(%self, %cuda_enabled, %cpu_enabled)
7913 %cloned = aten::clone(%ret, %bias)
7914 return (%cloned)
7915 )IR";
7916
7917 auto self0 = at::rand({6, 6, 6});
7918 auto cuda_enabled0 = false;
7919 auto cpu_enabled0 = false;
7920 std::vector<IValue> args{self0, cuda_enabled0, cpu_enabled0};
7921 testStaticRuntime(script, args);
7922 }
7923
TEST(StaticRuntime,autogen_swapaxes)7924 TEST(StaticRuntime, autogen_swapaxes) {
7925 const std::string script = R"IR(
7926 graph(%self: Tensor, %axis0: int, %axis1: int):
7927 %bias: None = prim::Constant()
7928 %ret = aten::swapaxes(%self, %axis0, %axis1)
7929 %cloned = aten::clone(%ret, %bias)
7930 return (%cloned)
7931 )IR";
7932
7933 auto self0 = at::rand({6, 6, 6});
7934 auto axis00 = 1;
7935 auto axis10 = 1;
7936 std::vector<IValue> args{self0, axis00, axis10};
7937 testStaticRuntime(script, args);
7938 }
7939
TEST(StaticRuntime,autogen_swapdims)7940 TEST(StaticRuntime, autogen_swapdims) {
7941 const std::string script = R"IR(
7942 graph(%self: Tensor, %dim0: int, %dim1: int):
7943 %bias: None = prim::Constant()
7944 %ret = aten::swapdims(%self, %dim0, %dim1)
7945 %cloned = aten::clone(%ret, %bias)
7946 return (%cloned)
7947 )IR";
7948
7949 auto self0 = at::rand({6, 6, 6});
7950 auto dim00 = 1;
7951 auto dim10 = 1;
7952 std::vector<IValue> args{self0, dim00, dim10};
7953 testStaticRuntime(script, args);
7954 }
7955
TEST(StaticRuntime,autogen_unfold)7956 TEST(StaticRuntime, autogen_unfold) {
7957 const std::string script = R"IR(
7958 graph(%self: Tensor, %dimension: int, %size: int, %step: int):
7959 %bias: None = prim::Constant()
7960 %ret = aten::unfold(%self, %dimension, %size, %step)
7961 %cloned = aten::clone(%ret, %bias)
7962 return (%cloned)
7963 )IR";
7964
7965 auto self0 = at::rand({6, 6, 6});
7966 auto dimension0 = 1;
7967 auto size0 = 1;
7968 auto step0 = 1;
7969 std::vector<IValue> args{self0, dimension0, size0, step0};
7970 testStaticRuntime(script, args);
7971 }
7972
TEST(StaticRuntime,autogen_alias)7973 TEST(StaticRuntime, autogen_alias) {
7974 const std::string script = R"IR(
7975 graph(%self: Tensor):
7976 %bias: None = prim::Constant()
7977 %ret = aten::alias(%self)
7978 %cloned = aten::clone(%ret, %bias)
7979 return (%cloned)
7980 )IR";
7981
7982 auto self0 = at::rand({6, 6, 6});
7983 std::vector<IValue> args{self0};
7984 testStaticRuntime(script, args);
7985 }
7986