| 65 | } |
| 66 | |
| 67 | core::TensorShape tensor_shape_from_vector(const std::vector<int64_t> & shape) { |
| 68 | if (shape.empty()) { |
| 69 | return core::TensorShape::from_dims({1}); |
| 70 | } |
| 71 | if (shape.size() == 1) { |
| 72 | return core::TensorShape::from_dims({shape[0]}); |
| 73 | } |
| 74 | if (shape.size() == 2) { |
| 75 | return core::TensorShape::from_dims({shape[0], shape[1]}); |
| 76 | } |
| 77 | if (shape.size() == 3) { |
| 78 | return core::TensorShape::from_dims({shape[0], shape[1], shape[2]}); |
| 79 | } |
| 80 | if (shape.size() == 4) { |
| 81 | return core::TensorShape::from_dims({shape[0], shape[1], shape[2], shape[3]}); |
| 82 | } |
| 83 | throw std::runtime_error("ZipEnhancer tensor rank exceeds GGML wrapper rank"); |
| 84 | } |
| 85 | |
| 86 | struct Param { |
| 87 | std::vector<int64_t> shape; |
no test coverage detected