Helper to create PyTorch sequential tensor
| 88 | |
| 89 | // Helper to create PyTorch sequential tensor |
| 90 | torch::Tensor create_torch_sequential(const std::vector<int64_t>& shape, |
| 91 | torch::Device device = torch::kCUDA) { |
| 92 | int64_t n = 1; |
| 93 | for (auto s : shape) |
| 94 | n *= s; |
| 95 | |
| 96 | std::vector<float> data(n); |
| 97 | for (int64_t i = 0; i < n; ++i) { |
| 98 | data[i] = static_cast<float>(i); |
| 99 | } |
| 100 | |
| 101 | return create_torch_tensor(data, shape, device); |
| 102 | } |
| 103 | |
| 104 | } // anonymous namespace |
| 105 |
no test coverage detected