Commit 8789fec4 authored by Po-Yen, Chen's avatar Po-Yen, Chen
Browse files

Simply initialize tensor with floating point values

parent 77f87d3a
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "ck/library/utility/check_err.hpp" #include "ck/library/utility/check_err.hpp"
#include "ck/library/utility/device_memory.hpp" #include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/fill.hpp"
#include "ck/library/utility/host_tensor.hpp" #include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor_generator.hpp" #include "ck/library/utility/host_tensor_generator.hpp"
......
...@@ -27,7 +27,8 @@ bool run_permute(const ExecutionConfig& config, const Problem& problem) ...@@ -27,7 +27,8 @@ bool run_permute(const ExecutionConfig& config, const Problem& problem)
{ {
auto* const elems = auto* const elems =
reinterpret_cast<detail::get_bundled_t<ADataType, NUM_ELEMS_IN_BUNDLE>*>(data(a.mData)); reinterpret_cast<detail::get_bundled_t<ADataType, NUM_ELEMS_IN_BUNDLE>*>(data(a.mData));
std::iota(elems, elems + (size(a.mData) * NUM_ELEMS_IN_BUNDLE), 1); ck::utils::FillUniformDistribution<ADataType>{-1.f, 1.f}(
elems, elems + (size(a.mData) * NUM_ELEMS_IN_BUNDLE));
} }
DeviceMem a_device_buf(sizeof(ADataType) * a.mDesc.GetElementSpaceSize()); DeviceMem a_device_buf(sizeof(ADataType) * a.mDesc.GetElementSpaceSize());
...@@ -103,8 +104,8 @@ bool run_permute(const ExecutionConfig& config, const Problem& problem) ...@@ -103,8 +104,8 @@ bool run_permute(const ExecutionConfig& config, const Problem& problem)
b.mDesc.GetElementSpaceSize() * NUM_ELEMS_IN_BUNDLE}, b.mDesc.GetElementSpaceSize() * NUM_ELEMS_IN_BUNDLE},
ck::span<const DataType>{extended_host_b.mData}, ck::span<const DataType>{extended_host_b.mData},
"Error: incorrect results in output tensor", "Error: incorrect results in output tensor",
1e-10, 1e-5,
1e-10); 1e-5);
#endif #endif
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment