MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / main

Function main

examples/neon_gemm_qasymm8_signed.cpp:94–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94int main(int argc, char **argv)
95{
96 Tensor src1;
97 Tensor src2;
98 Tensor dst0;
99 Tensor q_src1;
100 Tensor q_src2;
101 Tensor q_dst0;
102 Tensor q_res;
103 Tensor q_res_output;
104 size_t M = 4;
105 size_t N = 4;
106 size_t K = 4;
107
108 // Parse args
109 if (argc < 3) /* case default matrix sizes */
110 {
111 // Print help
112 std::cout << "Usage: ./build/neon_gemm_qasymm8_signed M N K\n";
113 std::cout << "Too few or no inputs provided. Using default M=4, N=4, K=4\n\n";
114 }
115 else /* case M N K arguments provided */
116 {
117 M = strtol(argv[1], nullptr, 10);
118 N = strtol(argv[2], nullptr, 10);
119 K = strtol(argv[3], nullptr, 10);
120 }
121
122 /*** Floating point matrix multiplication ***/
123
124 // Initialise input matrices
125 NEGEMM fgemm{};
126
127 src1.allocator()->init(TensorInfo(TensorShape(K, M), 1, DataType::F32));
128 src2.allocator()->init(TensorInfo(TensorShape(N, K), 1, DataType::F32));
129 dst0.allocator()->init(TensorInfo(TensorShape(N, M), 1, DataType::F32));
130 fgemm.configure(&src1, &src2, nullptr, &dst0, 1, 0);
131
132 // Allocate matrices
133 src1.allocator()->allocate();
134 src2.allocator()->allocate();
135 dst0.allocator()->allocate();
136
137 // Fill in tensors, by default fill in with known data - for easy testing
138 auto *src1_ptr = reinterpret_cast<float *>(src1.buffer());
139 auto *src2_ptr = reinterpret_cast<float *>(src2.buffer());
140 auto *dst0_ptr = reinterpret_cast<float *>(dst0.buffer());
141
142 // Fill in with random values
143 fill_random_tensor(src1, -1.f, 1.f);
144 fill_random_tensor(src2, -1.f, 1.f);
145
146 // Run single precision gemm and print result
147 fgemm.run();
148
149#if ARM_COMPUTE_DEBUG_ENABLED
150 std::cout << "Result matrix:\n";
151 src1.print(std::cout);

Callers

nothing calls this directly

Calls 15

fill_random_tensorFunction · 0.85
GEMMInfoClass · 0.85
scaleMethod · 0.80
offsetMethod · 0.80
find_min_maxFunction · 0.70
invert_qinfo_offsetFunction · 0.70
TensorInfoClass · 0.50
TensorShapeClass · 0.50
QuantizationInfoClass · 0.50
ActivationLayerInfoClass · 0.50

Tested by

no test coverage detected