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

Class Gemm

test/blas.cpp:554–598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

552};
553
554class Gemm : public ::testing::TestWithParam<test_params> {
555 protected:
556 af_array lhs;
557 af_array rhs;
558 af_array gold;
559 af_array out;
560 TestOutputArrayInfo metadata;
561
562 void SetUp() {
563 test_params params = GetParam();
564
565 lhs = 0;
566 rhs = 0;
567 out = 0;
568 gold = 0;
569
570 ASSERT_SUCCESS(af_create_array(&lhs, params.h_lhs,
571 params.lhs_dims.ndims(),
572 params.lhs_dims.get(), f32));
573 ASSERT_SUCCESS(af_create_array(&rhs, params.h_rhs,
574 params.rhs_dims.ndims(),
575 params.rhs_dims.get(), f32));
576
577 dim_t gold_dim0 = params.opt_lhs == AF_MAT_TRANS ? params.lhs_dims[1]
578 : params.lhs_dims[0];
579 dim_t gold_dim1 = params.opt_rhs == AF_MAT_TRANS ? params.rhs_dims[0]
580 : params.rhs_dims[1];
581 dim_t gold_dim2 = std::max(params.lhs_dims[2], params.rhs_dims[2]);
582 dim_t gold_dim3 = std::max(params.lhs_dims[3], params.rhs_dims[3]);
583 dim4 gold_dims(gold_dim0, gold_dim1, gold_dim2, gold_dim3);
584
585 metadata = TestOutputArrayInfo(params.out_array_type);
586 genTestOutputArray(&out, params.out_dims.ndims(), params.out_dims.get(),
587 f32, &metadata);
588
589 ASSERT_SUCCESS(af_create_array(&gold, params.h_gold, gold_dims.ndims(),
590 gold_dims.get(), f32));
591 }
592
593 void TearDown() {
594 if (gold != 0) { ASSERT_SUCCESS(af_release_array(gold)); }
595 if (rhs != 0) { ASSERT_SUCCESS(af_release_array(rhs)); }
596 if (lhs != 0) { ASSERT_SUCCESS(af_release_array(lhs)); }
597 }
598};
599
600void replace_all(std::string &str, const std::string &oldStr,
601 const std::string &newStr) {

Callers 1

operator()Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected