-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CPU test for swin_tiny_2 model (#940)
- Loading branch information
Showing
2 changed files
with
85 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
forge/test/models/pytorch/vision/swin/utils/image_utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# SPDX-FileCopyrightText: © 2024 Tenstorrent AI ULC | ||
|
||
# SPDX-License-Identifier: Apache-2.0 | ||
from PIL import Image | ||
import requests | ||
|
||
|
||
def load_image(image_path, feature_extractor): | ||
image = Image.open(requests.get(image_path, stream=True).raw) | ||
img_tensor = feature_extractor(images=image, return_tensors="pt").pixel_values | ||
return [img_tensor] |