| 33 | { |
| 34 | public: |
| 35 | bool do_setup(int argc, char **argv) override |
| 36 | { |
| 37 | size_t m = 4096; |
| 38 | size_t n = 4096; |
| 39 | size_t k = 128; |
| 40 | |
| 41 | if (argc == 4) |
| 42 | { |
| 43 | try |
| 44 | { |
| 45 | m = std::stoul(argv[1]); |
| 46 | n = std::stoul(argv[2]); |
| 47 | k = std::stoul(argv[3]); |
| 48 | } |
| 49 | catch (const std::exception &e) |
| 50 | { |
| 51 | ARM_COMPUTE_ERROR(e.what()); |
| 52 | return false; |
| 53 | } |
| 54 | } |
| 55 | else if (argc != 1) |
| 56 | { |
| 57 | ARM_COMPUTE_ERROR("Invalid number of arguments. Usage:\n" |
| 58 | "<M> <N> <K>\n"); |
| 59 | return false; |
| 60 | } |
| 61 | |
| 62 | const TensorInfo a_info{TensorShape{k, m}, 1, DataType::F32, DataLayout::NHWC}; |
| 63 | const TensorInfo b_info{TensorShape{n, k}, 1, DataType::F32, DataLayout::NHWC}; |
| 64 | const TensorInfo output_info{TensorShape{n, m}, 1, DataType::F32, DataLayout::NHWC}; |
| 65 | |
| 66 | a.allocator()->init(a_info); |
| 67 | b.allocator()->init(b_info); |
| 68 | output.allocator()->init(output_info); |
| 69 | |
| 70 | a.info()->set_are_values_constant(false); |
| 71 | b.info()->set_are_values_constant(false); |
| 72 | output.info()->set_are_values_constant(false); |
| 73 | |
| 74 | const MatMulInfo info; |
| 75 | const CpuMatMulSettings settings; |
| 76 | |
| 77 | auto status = NEMatMul::validate(a.info(), b.info(), output.info(), info, settings); |
| 78 | if (status.error_code() != ErrorCode::OK) |
| 79 | { |
| 80 | ARM_COMPUTE_ERROR(status.error_description().c_str()); |
| 81 | return false; |
| 82 | } |
| 83 | |
| 84 | matmul.configure(&a, &b, &output, info, settings); |
| 85 | a.allocator()->allocate(); |
| 86 | b.allocator()->allocate(); |
| 87 | output.allocator()->allocate(); |
| 88 | |
| 89 | // Fill with fixed values |
| 90 | const std::vector<float> values_a(m * k, 2.2f); |
| 91 | const std::vector<float> values_b(n * k, 3.5f); |
| 92 | fill_tensor_vector(a, values_a); |
nothing calls this directly
no test coverage detected