| 58 | } |
| 59 | |
| 60 | core::Tensor make_external_float_tensor( |
| 61 | std::vector<std::shared_ptr<std::vector<float>>>& owners, |
| 62 | core::TensorShape shape, |
| 63 | const size_t capacity, |
| 64 | std::string kind = "splat.exportable") { |
| 65 | const size_t element_count = std::max(shape.elements(), capacity); |
| 66 | auto owner = std::make_shared<std::vector<float>>(element_count, 0.0f); |
| 67 | auto* data = owner->data(); |
| 68 | owners.push_back(owner); |
| 69 | return core::Tensor::from_external_owner(data, |
| 70 | std::move(shape), |
| 71 | core::Device::CPU, |
| 72 | core::DataType::Float32, |
| 73 | std::move(owner), |
| 74 | capacity, |
| 75 | nullptr, |
| 76 | std::move(kind)); |
| 77 | } |
| 78 | |
| 79 | void expect_sh_degree(const core::SplatData& splat, |
| 80 | const int max_sh_degree, |