|
1 | 1 | #include "ggml.h"
|
2 | 2 | #include "gguf.h"
|
| 3 | +#include "clip.h" |
3 | 4 |
|
4 | 5 | #include "clip.h"
|
5 | 6 |
|
@@ -202,23 +203,31 @@ static void clip_log_internal(enum ggml_log_level level, const char * format, ..
|
202 | 203 | // cpp wrappers
|
203 | 204 | //
|
204 | 205 |
|
| 206 | +// wrapper for clip_image_size |
| 207 | +struct clip_image_size_deleter { |
| 208 | + void operator()(clip_image_size * val) { clip_image_size_free(val); } |
| 209 | +}; |
| 210 | +typedef std::unique_ptr<clip_image_size, clip_image_size_deleter> clip_image_size_ptr; |
| 211 | + |
| 212 | +// wrapper for clip_image_u8 |
205 | 213 | struct clip_image_u8_deleter {
|
206 | 214 | void operator()(clip_image_u8 * val) { clip_image_u8_free(val); }
|
207 | 215 | };
|
| 216 | +typedef std::unique_ptr<clip_image_u8, clip_image_u8_deleter> clip_image_u8_ptr; |
208 | 217 |
|
| 218 | +// wrapper for clip_image_f32 |
209 | 219 | struct clip_image_f32_deleter {
|
210 | 220 | void operator()(clip_image_f32 * val) { clip_image_f32_free(val); }
|
211 | 221 | };
|
| 222 | +typedef std::unique_ptr<clip_image_f32, clip_image_f32_deleter> clip_image_f32_ptr; |
212 | 223 |
|
213 |
| -struct clip_image_f32_batch_deleter { |
214 |
| - void operator()(clip_image_f32_batch * val) { clip_image_f32_batch_free(val); } |
| 224 | +struct clip_image_u8_batch { |
| 225 | + std::vector<clip_image_u8_ptr> entries; |
215 | 226 | };
|
216 | 227 |
|
217 |
| -typedef std::unique_ptr<clip_image_u8, clip_image_u8_deleter> clip_image_u8_ptr; |
218 |
| -typedef std::unique_ptr<clip_image_f32, clip_image_f32_deleter> clip_image_f32_ptr; |
219 |
| -typedef std::unique_ptr<clip_image_f32_batch, clip_image_f32_batch_deleter> clip_image_f32_batch_ptr; |
220 |
| - |
221 |
| -// TODO @ngxson : we're currently having a naming clash between struct clip_image_size and function clip_image_size() |
| 228 | +struct clip_image_f32_batch { |
| 229 | + std::vector<clip_image_f32_ptr> entries; |
| 230 | +}; |
222 | 231 |
|
223 | 232 | //
|
224 | 233 | // common utils
|
|
0 commit comments