Skip to content

Commit

Permalink
Improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinthesun committed Sep 15, 2020
1 parent f0c7c6e commit 7ab4f31
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tests/python/frontend/pytorch/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -3241,6 +3241,7 @@ def test_forward_pretrained_bert_base_uncased():


if __name__ == "__main__":
"""
# some structural tests
test_forward_traced_function()
test_forward_dtypes()
Expand Down Expand Up @@ -3398,6 +3399,7 @@ def test_forward_pretrained_bert_base_uncased():
# Test bert model
test_forward_pretrained_bert_base_uncased()
"""

# Test object detection models
from test_object_detection import test_detection_models
Expand Down
4 changes: 3 additions & 1 deletion tests/python/frontend/pytorch/test_object_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# under the License.
# pylint: disable=import-self, invalid-name, unused-argument
"""Test torch vision fasterrcnn and maskrcnn models"""
import numpy as np
import torch
import torchvision
import cv2
Expand All @@ -31,6 +32,7 @@

def process_image(img):
img = cv2.imread(img).astype("float32")
img = cv2.resize(img, (in_size, in_size))
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
img = torch.from_numpy(img/255.).permute(2,0,1).float()
img = torch.unsqueeze(img, axis=0)
Expand Down Expand Up @@ -68,7 +70,7 @@ def generate_jit_model(index, img):
model = TraceWrapper(model_func(pretrained=True))

model.eval()
inp = process_image(img)
inp = torch.Tensor(np.random.uniform(0.0, 250.0,size=(1, 3, in_size, in_size)))

with torch.no_grad():
out = model(inp)
Expand Down

0 comments on commit 7ab4f31

Please sign in to comment.