MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / testTwoLargeNonLinear

Function testTwoLargeNonLinear

test/jit.cpp:612–645  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

610}
611
612void testTwoLargeNonLinear(const af_dtype dt) {
613 int dimsize = 10;
614 array a = constant(0, dimsize, dimsize, dt);
615 array aa = constant(0, dimsize, dimsize, dt);
616 array b = constant(0, dimsize, dimsize, dt);
617 array bb = constant(0, dimsize, dimsize, dt);
618
619 int val = 0;
620 for (int i = 0; i < 23; i++) {
621 array ones = constant(1, dimsize, dimsize, dt);
622 ones.eval();
623 array twos = constant(2, dimsize, dt);
624 twos.eval();
625
626 a += tile(twos, 1, dimsize) + ones;
627 aa += tile(twos, 1, dimsize) + ones;
628 val += 3;
629 }
630
631 for (int i = 0; i < 23; i++) {
632 array ones = constant(1, dimsize, dimsize, dt);
633 ones.eval();
634 array twos = constant(2, dimsize, dt);
635 twos.eval();
636 b += tile(twos, 1, dimsize) + ones;
637 bb += tile(twos, 1, dimsize) + ones;
638 }
639 array c = a + b;
640 array cc = aa + bb;
641 eval(c, cc);
642
643 vector<float> gold(a.elements(), val * 2);
644 ASSERT_VEC_ARRAY_EQ(gold, a.dims(), c.as(f32));
645}
646
647TEST(JIT, TwoLargeNonLinear) { testTwoLargeNonLinear(f32); }
648

Callers 1

TESTFunction · 0.85

Calls 7

constantFunction · 0.85
asMethod · 0.80
tileFunction · 0.50
evalFunction · 0.50
evalMethod · 0.45
elementsMethod · 0.45
dimsMethod · 0.45

Tested by

no test coverage detected