#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include "example_utils.hpp"
M = 128, K = 256, N = 512;
std::vector<float> src_data(product(src_dims));
std::vector<float> weights_data(product(weights_dims));
std::vector<float> bias_data(product(bias_dims));
std::vector<float> dst_data(product(dst_dims));
std::generate(src_data.begin(), src_data.end(), []() {
static int i = 0;
return std::cos(i++ / 10.f);
});
std::generate(weights_data.begin(), weights_data.end(), []() {
static int i = 0;
return std::sin(i++ * 2.f);
});
std::generate(bias_data.begin(), bias_data.end(), []() {
static int i = 0;
return std::tanh(i++);
});
write_to_dnnl_memory(src_data.data(), src_mem);
write_to_dnnl_memory(weights_data.data(), weights_mem);
write_to_dnnl_memory(bias_data.data(), bias_mem);
const float scale = 1.0f;
const float alpha = 0.f;
const float beta = 0.f;
auto matmul_prim =
matmul(matmul_pd);
std::unordered_map<int, memory> matmul_args;
matmul_prim.execute(engine_stream, matmul_args);
engine_stream.wait();
read_from_dnnl_memory(dst_data.data(), dst_mem);
}
int main(int argc, char **argv) {
return handle_example_errors(matmul_example, parse_engine_kind(argc, argv));
}