File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -12,16 +12,24 @@ namespace partitioning {
1212at::Tensor generateSingleInput (ir::Input& input, c10::optional<at::ScalarType>& type_opt) {
1313 auto cur_shape = input.input_shape ;
1414 std::vector<int64_t > shape;
15+
16+ // Initialize min and max ranges for random number selection
17+ int LoValIncl = 0 ;
18+ int HiValExcl = 2 ;
19+
1520 shape.insert (shape.begin (), std::begin (cur_shape.d ), std::begin (cur_shape.d ) + cur_shape.nbDims );
16- // auto type_opt = types[input.first][i];
21+
1722 auto type = at::kFloat ;
1823 if (type_opt) {
1924 type = type_opt.value ();
2025 } else {
2126 LOG_WARNING (" Input type for doing shape analysis could not be determined, defaulting to F32" );
2227 }
23- auto in = at::randint (5 , shape, {at::kCUDA }).to (type);
24- // ivalue_map[input.first] = in.clone();
28+
29+ // Make the value range for input tensor a uniform (float) distribution
30+ // over [LoValIncl, HiValExcl), then cast to the desired dtype
31+ auto in = ((HiValExcl - LoValIncl) * at::rand (shape, {at::kCUDA }) + LoValIncl).to (type);
32+
2533 return in;
2634}
2735
You can’t perform that action at this time.
0 commit comments