#ifndef HOST_TENSOR_GENERATOR_HPP #define HOST_TENSOR_GENERATOR_HPP #include #include "config.hpp" struct GeneratorTensor_1 { int value = 1; template double operator()(Is... is) { return value; } }; struct GeneratorTensor_2 { int min_value = 0; int max_value = 1; template double operator()(Is...) { return (std::rand() % (max_value - min_value)) + min_value; } }; struct GeneratorTensor_3 { template double operator()(Is... is) { std::array dims = {{static_cast(is)...}}; auto f_acc = [](auto a, auto b) { return 10 * a + b; }; return std::accumulate(dims.begin(), dims.end(), ck::index_t(0), f_acc); } }; struct GeneratorTensor_Checkboard { template double operator()(Ts... Xs) const { std::array dims = {{static_cast(Xs)...}}; return std::accumulate(dims.begin(), dims.end(), true, [](bool init, ck::index_t x) -> int { return init != (x % 2); }) ? 1 : -1; } }; #endif