generate.cpp 428 Bytes
Newer Older
Paul's avatar
Paul committed
1
2
3
4
5
6
7
#include <rtg/generate.hpp>

namespace rtg {

rtg::argument generate_argument(rtg::shape s, std::mt19937::result_type seed)
{
    rtg::argument result;
Paul's avatar
Paul committed
8
    s.visit_type([&](auto as) {
Paul's avatar
Paul committed
9
        using type = typename decltype(as)::type;
Paul's avatar
Paul committed
10
11
        auto v     = generate_tensor_data<type>(s, seed);
        result     = {s, [v]() mutable { return reinterpret_cast<char*>(v.data()); }};
Paul's avatar
Paul committed
12
13
14
15
16
    });
    return result;
}

} // namespace rtg