| 238 | |
| 239 | float batch_tol = 1E-2; |
| 240 | TEST(MatrixMultiply, Batched) { |
| 241 | const int M = 512; |
| 242 | const int K = 512; |
| 243 | const int N = 10; |
| 244 | const int D2 = 2; |
| 245 | const int D3 = 3; |
| 246 | for (int d3 = 1; d3 <= D3; d3 *= D3) { |
| 247 | for (int d2 = 1; d2 <= D2; d2 *= D2) { |
| 248 | array a = randu(M, K, d2, d3); |
| 249 | array b = randu(K, N, d2, d3); |
| 250 | array c = matmul(a, b); |
| 251 | |
| 252 | for (int j = 0; j < d3; j++) { |
| 253 | for (int i = 0; i < d2; i++) { |
| 254 | array a_ij = a(span, span, i, j); |
| 255 | array b_ij = b(span, span, i, j); |
| 256 | array c_ij = c(span, span, i, j); |
| 257 | array res = matmul(a_ij, b_ij); |
| 258 | ASSERT_ARRAYS_NEAR(c_ij, res, batch_tol); |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | #undef DEVICE_ITERATE |
| 266 |
nothing calls this directly
no test coverage detected