@@ -10,7 +10,7 @@ namespace mlc {
10
10
namespace llm {
11
11
12
12
void CalculateResizeShape (tvm::runtime::NDArray image_data, std::string model_type,
13
- int & target_height , int & target_width ) {
13
+ int * p_target_height , int * p_target_width ) {
14
14
ICHECK_EQ (image_data->shape [3 ], 3 ) << " Image format must be NHWC" ;
15
15
int height = image_data->shape [1 ];
16
16
int width = image_data->shape [2 ];
@@ -23,34 +23,34 @@ void CalculateResizeShape(tvm::runtime::NDArray image_data, std::string model_ty
23
23
scale += 1 ;
24
24
}
25
25
scale -= 1 ;
26
- target_width = static_cast <int >(scale * 336 );
27
- target_height = static_cast <int >(target_width / ratio);
26
+ *p_target_width = static_cast <int >(scale * 336 );
27
+ *p_target_height = static_cast <int >(*p_target_width / ratio);
28
28
}
29
29
}
30
30
31
- void CalculatePadShape (tvm::runtime::NDArray image_data, std::string model_type, int & pad_height ,
32
- int & pad_width ) {
31
+ void CalculatePadShape (tvm::runtime::NDArray image_data, std::string model_type, int * p_pad_height ,
32
+ int * p_pad_width ) {
33
33
ICHECK_EQ (image_data->shape [3 ], 3 ) << " Image format must be NHWC" ;
34
34
if (" phi3_v" == model_type) {
35
35
int resized_height = 0 , resized_width = 0 ;
36
- CalculateResizeShape (image_data, model_type, resized_height, resized_width);
36
+ CalculateResizeShape (image_data, model_type, & resized_height, & resized_width);
37
37
int tar = (int )(ceil (resized_height / 336.0 ) * 336 );
38
38
int top_padding = (int )((tar - resized_height) / 2 );
39
39
int bottom_padding = tar - resized_height - top_padding;
40
40
ICHECK_EQ (tar, resized_height + top_padding + bottom_padding) << " Padding size not equal!" ;
41
- pad_height = tar;
42
- pad_width = resized_width;
41
+ *p_pad_height = tar;
42
+ *p_pad_width = resized_width;
43
43
}
44
44
}
45
45
46
- void CalculateCropShape (tvm::runtime::NDArray image_data, std::string model_type, int & crop_height,
47
- int & crop_width ) {
46
+ void CalculateCropShape (tvm::runtime::NDArray image_data, std::string model_type,
47
+ int * p_crop_height, int * p_crop_width ) {
48
48
ICHECK_EQ (image_data->shape [3 ], 3 ) << " Image format must be NHWC" ;
49
49
if (" phi3_v" == model_type) {
50
50
int pad_h = 0 , pad_w = 0 ;
51
- CalculatePadShape (image_data, model_type, pad_h, pad_w);
52
- crop_height = pad_h / 336 ;
53
- crop_width = pad_w / 336 ;
51
+ CalculatePadShape (image_data, model_type, & pad_h, & pad_w);
52
+ *p_crop_height = pad_h / 336 ;
53
+ *p_crop_width = pad_w / 336 ;
54
54
}
55
55
}
56
56
0 commit comments