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

Function matrix_multiply

tests/validation/Helpers.cpp:169–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167
168template <typename T>
169void matrix_multiply(const SimpleTensor<T> &a, const SimpleTensor<T> &b, SimpleTensor<T> &out)
170{
171 ARM_COMPUTE_ERROR_ON(a.shape()[0] != b.shape()[1]);
172 ARM_COMPUTE_ERROR_ON(a.shape()[1] != out.shape()[1]);
173 ARM_COMPUTE_ERROR_ON(b.shape()[0] != out.shape()[0]);
174
175 const int M = a.shape()[1]; // Rows
176 const int N = b.shape()[0]; // Cols
177 const int K = b.shape()[1];
178
179#if defined(_OPENMP)
180#pragma omp parallel for collapse(2)
181#endif /* _OPENMP */
182 for (int y = 0; y < M; ++y)
183 {
184 for (int x = 0; x < N; ++x)
185 {
186 float acc = 0.0f;
187 for (int k = 0; k < K; ++k)
188 {
189 acc += a[y * K + k] * b[x + k * N];
190 }
191
192 out[x + y * N] = acc;
193 }
194 }
195}
196
197template <typename T>
198void transpose_matrix(const SimpleTensor<T> &in, SimpleTensor<T> &out)

Callers

nothing calls this directly

Calls 1

shapeMethod · 0.45

Tested by

no test coverage detected