Change initialization method of tensor for iGEMM (#49)

* change init method

[ROCm/composable_kernel commit: 0a72e4df94]
This commit is contained in:
Chao Liu
2021-07-16 22:55:01 -05:00
committed by GitHub
parent 9e04c9faef
commit 4c61ba83c6
4 changed files with 101 additions and 79 deletions

View File

@@ -9,7 +9,7 @@ struct GeneratorTensor_1
int value = 1;
template <typename... Is>
double operator()(Is... is)
float operator()(Is... is)
{
return value;
}
@@ -21,29 +21,31 @@ struct GeneratorTensor_2
int max_value = 1;
template <typename... Is>
double operator()(Is...)
float operator()(Is...)
{
return (std::rand() % (max_value - min_value)) + min_value;
}
};
template <typename T>
struct GeneratorTensor_3
{
T min_value = 0;
T max_value = 1;
template <typename... Is>
double operator()(Is... is)
float operator()(Is...)
{
std::array<ck::index_t, sizeof...(Is)> dims = {{static_cast<ck::index_t>(is)...}};
float tmp = float(std::rand()) / float(RAND_MAX);
auto f_acc = [](auto a, auto b) { return 10 * a + b; };
return std::accumulate(dims.begin(), dims.end(), ck::index_t(0), f_acc);
return min_value + tmp * (max_value - min_value);
}
};
struct GeneratorTensor_Checkboard
{
template <typename... Ts>
double operator()(Ts... Xs) const
float operator()(Ts... Xs) const
{
std::array<ck::index_t, sizeof...(Ts)> dims = {{static_cast<ck::index_t>(Xs)...}};
return std::accumulate(dims.begin(),