| 59 | } |
| 60 | |
| 61 | BoltTensor 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 | |
| 74 | RowVectorPtr TorchTest::MakeTable( |
| 75 | const size_t num_columns, |