Skip to content

Commit 6129b96

Browse files
authored
Make image and audio variables const references
Bind the result of `get_image()` and `get_audio()` to const ref to avoid copy.
1 parent 3591604 commit 6129b96

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

extension/llm/runner/multimodal_prefiller.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Result<uint64_t> MultimodalPrefiller::prefill(
4040
// 1. Run encoder model.
4141
::executorch::runtime::EValue encoder_output;
4242
if (input.is_image()) {
43-
Image image = input.get_image();
43+
const Image& image = input.get_image();
4444

4545
auto method_meta = ET_UNWRAP(
4646
module_->method_meta(kVisionEncoderMethod),
@@ -91,7 +91,7 @@ Result<uint64_t> MultimodalPrefiller::prefill(
9191

9292
encoder_output = image_encoder_outputs[0];
9393
} else if (input.is_audio()) {
94-
Audio audio = input.get_audio();
94+
const Audio& audio = input.get_audio();
9595

9696
// Use Audio::toTensor() for tensor creation
9797
auto audio_tensor =

0 commit comments

Comments
 (0)