#ifndef HOST_TENSOR_GENERATOR_HPP #define HOST_TENSOR_GENERATOR_HPP #include #include "config.hpp" struct GeneratorTensor_1 { int value = 1; template float operator()(Is... is) { return value; } }; struct GeneratorTensor_2 { int min_value = 0; int max_value = 1; template float operator()(Is...) { return (std::rand() % (max_value - min_value)) + min_value; } }; template struct GeneratorTensor_3 { T min_value = 0; T max_value = 1; template float operator()(Is...) { float tmp = float(std::rand()) / float(RAND_MAX); return min_value + tmp * (max_value - min_value); } }; struct GeneratorTensor_Checkboard { template float 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