Testing and Validation

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import torch
from yann.testing import check_tensor


t = torch.randn(32, 3, 224, 224)
t2 = t

check_tensor(
  t,
  device='cpu',
  gte=0,  # greater than or equal
  lte=1,  # less than or equal
  share_memory=t2,  # using the same storage
  shape=(None, 3, 224, 224),  # dimensions match
  anomalies=True,  # check for infs or NaNs
)