Skip to content

Commit 7ab4f31

Browse files
committed
Improve test
1 parent f0c7c6e commit 7ab4f31

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

tests/python/frontend/pytorch/test_forward.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3241,6 +3241,7 @@ def test_forward_pretrained_bert_base_uncased():
32413241

32423242

32433243
if __name__ == "__main__":
3244+
"""
32443245
# some structural tests
32453246
test_forward_traced_function()
32463247
test_forward_dtypes()
@@ -3398,6 +3399,7 @@ def test_forward_pretrained_bert_base_uncased():
33983399
33993400
# Test bert model
34003401
test_forward_pretrained_bert_base_uncased()
3402+
"""
34013403

34023404
# Test object detection models
34033405
from test_object_detection import test_detection_models

tests/python/frontend/pytorch/test_object_detection.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# under the License.
1717
# pylint: disable=import-self, invalid-name, unused-argument
1818
"""Test torch vision fasterrcnn and maskrcnn models"""
19+
import numpy as np
1920
import torch
2021
import torchvision
2122
import cv2
@@ -31,6 +32,7 @@
3132

3233
def process_image(img):
3334
img = cv2.imread(img).astype("float32")
35+
img = cv2.resize(img, (in_size, in_size))
3436
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
3537
img = torch.from_numpy(img/255.).permute(2,0,1).float()
3638
img = torch.unsqueeze(img, axis=0)
@@ -68,7 +70,7 @@ def generate_jit_model(index, img):
6870
model = TraceWrapper(model_func(pretrained=True))
6971

7072
model.eval()
71-
inp = process_image(img)
73+
inp = torch.Tensor(np.random.uniform(0.0, 250.0,size=(1, 3, in_size, in_size)))
7274

7375
with torch.no_grad():
7476
out = model(inp)

0 commit comments

Comments
 (0)