#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include "example_utils.hpp"
N = 3,
C = 227;
std::vector<float> src_data(product(src_dims));
std::vector<float> scale_shift_data(product(scale_shift_dims));
std::generate(src_data.begin(), src_data.end(), []() {
static int i = 0;
return std::cos(i++ / 10.f);
});
auto mid = scale_shift_data.begin() + C;
std::generate(scale_shift_data.begin(), mid, []() {
static int i = 0;
return std::sin(i++ * 2.f);
});
std::generate(mid, scale_shift_data.end(), []() {
static int i = 0;
return std::tanh(i++);
});
auto scale_shift_mem =
memory({scale_shift_dims, dt::f32, tag::nc},
engine);
write_to_dnnl_memory(src_data.data(), src_mem);
write_to_dnnl_memory(scale_shift_data.data(), scale_shift_mem);
const float epsilon = 1.e-10f;
auto lnorm_desc
auto lnorm_pd
auto variance_mem =
memory(lnorm_pd.variance_desc(),
engine);
std::unordered_map<int, memory> lnorm_args;
lnorm_prim.execute(engine_stream, lnorm_args);
read_from_dnnl_memory(src_data.data(), src_mem);
}
int main(int argc, char **argv) {
return handle_example_errors(
layer_normalization_example, parse_engine_kind(argc, argv));
}