Skip to content

Commit

Permalink
Add val_step unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyajie committed Sep 25, 2021
1 parent eb87ace commit 0ecffa1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test_models/test_segmentors/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ def _segmentor_forward_train_test(segmentor):
imgs, img_metas, gt_semantic_seg=gt_semantic_seg, return_loss=True)
assert isinstance(losses, dict)

# Test val_step
with torch.no_grad():
segmentor.eval()
data_batch = dict(
img=imgs, img_metas=img_metas, gt_semantic_seg=gt_semantic_seg)
outputs = segmentor.val_step(data_batch)
assert isinstance(outputs, dict)

# Test forward simple test
with torch.no_grad():
segmentor.eval()
Expand Down

0 comments on commit 0ecffa1

Please sign in to comment.