MCPcopy Create free account
hub / github.com/MrNeRF/LichtFeld-Studio / create_torch_sequential

Function create_torch_sequential

tests/test_tensor_broadcast.cpp:90–102  ·  view source on GitHub ↗

Helper to create PyTorch sequential tensor

Source from the content-addressed store, hash-verified

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

Callers 1

TEST_FFunction · 0.85

Calls 1

create_torch_tensorFunction · 0.70

Tested by

no test coverage detected