Skip to content

Commit b5299a8

Browse files
committed
Address review: add default comment, add padPortrait test
1 parent 8e38abe commit b5299a8

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

swift/Sources/CoreAILanguageModels/Bundle/LanguageConfig.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public struct VisionConfig: Codable, Sendable, Equatable {
172172
/// Image preprocessing strategy. Defaults to stretch when omitted.
173173
public let imageStrategy: ImageStrategy
174174

175-
/// Whether to include original image dimensions in the text prompt.
175+
/// Whether to include original image dimensions in the text prompt. Defaults to false.
176176
public let includeImageInfo: Bool
177177

178178
/// CLIP normalization (Qwen VL, Pixtral, InternVL, Phi-3.5-vision).

swift/Tests/CoreAISharedTests/ImagePreprocessorTests.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,17 @@ struct ImagePreprocessorTests {
243243
#expect(chw.count == 3 * 32 * 32)
244244
}
245245

246+
@Test("pad: portrait image has correct output size")
247+
func padPortrait() throws {
248+
let pre = ImagePreprocessor(
249+
targetSize: CGSize(width: 32, height: 32),
250+
mean: (0, 0, 0), std: (1, 1, 1), rescaleFactor: 1
251+
)
252+
let portrait = Self.makeSolidImage(width: 32, height: 64, r: 100, g: 150, b: 200)
253+
let chw = try pre.preprocessCHWPad(cgImage: portrait)
254+
#expect(chw.count == 3 * 32 * 32)
255+
}
256+
246257
@Test("strategy dispatch: all three strategies produce correct output size")
247258
func strategyDispatch() throws {
248259
let pre = ImagePreprocessor(

0 commit comments

Comments
 (0)