MCPcopy Create free account
hub / github.com/bytedance/bolt / MakeTensor

Method MakeTensor

bolt/torch/tests/utils.cpp:61–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61BoltTensor TorchTest::MakeTensor(::at::IntArrayRef sizes, TorchType type) {
62 size_t total_size =
63 std::reduce(
64 sizes.cbegin(),
65 sizes.cend(),
66 1,
67 [](size_t acc, const auto& val) { return acc * val; }) *
68 type.itemsize();
69 void* data = pool_->allocate(total_size);
70 memset(data, 2, total_size);
71 return {data, total_size, std::move(type), sizes, pool_.get()};
72}
73
74RowVectorPtr TorchTest::MakeTable(
75 const size_t num_columns,

Callers

nothing calls this directly

Calls 6

reduceFunction · 0.85
memsetFunction · 0.85
cbeginMethod · 0.80
cendMethod · 0.80
allocateMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected