File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
backends/vulkan/test/op_tests/utils Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -218,6 +218,25 @@ def generate_suite_cpp(self) -> str:
218
218
return at::rand(sizes, at::device(at::kCPU).dtype(dtype)) * (high - low) + low;
219
219
}}
220
220
221
+
222
+ at::Tensor make_seq_tensor(
223
+ std::vector<int64_t> sizes,
224
+ at::ScalarType dtype = at::kFloat) {{
225
+ int64_t n = 1;
226
+ for (auto size: sizes) {{
227
+ n *= size;
228
+ }}
229
+
230
+ std::vector<float> values(n);
231
+ for (int i=0;i<n;i++) {{
232
+ values[i] = (float) i;
233
+ }}
234
+
235
+ // from_blob doesn't take ownership of data. Hence must create a copy as
236
+ // "values" will go out of scope.
237
+ return at::from_blob(values.data(), sizes, dtype).detach().clone();
238
+ }}
239
+
221
240
{test_suites_cpp}
222
241
"""
223
242
You can’t perform that action at this time.
0 commit comments