MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / generate_argument

Function generate_argument

src/generate.cpp:53–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53argument generate_argument(shape s, unsigned long seed, random_mode m)
54{
55 argument result;
56 if(s.type() == shape::tuple_type)
57 {
58 const auto& sub_ss = s.sub_shapes();
59 std::vector<argument> sub_args;
60 std::transform(sub_ss.begin(), sub_ss.end(), std::back_inserter(sub_args), [&](auto ss) {
61 return generate_argument(ss, seed, m);
62 });
63
64 result = argument(sub_args);
65 }
66 // special processing for non-computable type
67 else if(not s.computable())
68 {
69 // NOTE: these values can be wrong (ex. not valid fp4x2)
70 auto v = generate_tensor_data<uint8_t>(s, seed, m);
71 result = {s, v};
72 }
73 else
74 {
75 s.visit_type([&](auto as) {
76 // we use char type to store bool type internally, so bool_type
77 // needs special processing to generate data
78 if(s.type() == shape::bool_type)
79 {
80 auto v = generate_tensor_data<bool>(s, seed, m);
81 result = {s, v};
82 }
83 else
84 {
85 using type = typename decltype(as)::type;
86 auto v = generate_tensor_data<type>(s, seed, m);
87 result = {s, v};
88 }
89 });
90 }
91
92 return result;
93}
94
95literal generate_literal(shape s, unsigned long seed)
96{

Callers 15

TEST_CASEFunction · 0.85
TEST_CASEFunction · 0.85
TEST_CASEFunction · 0.85
generate_paramsFunction · 0.85
verifyMethod · 0.85
TEST_CASEFunction · 0.85
fill_param_mapFunction · 0.85
create_param_mapFunction · 0.85
run_targetFunction · 0.85
validateMethod · 0.85
get_workspace_sizeMethod · 0.85
tuneMethod · 0.85

Calls 6

computableMethod · 0.80
transformFunction · 0.50
argumentFunction · 0.50
typeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1

TEST_CASEFunction · 0.68