コード例 #1
0
 def test_cuda_tuple(self):
     jt_model = jt.nn.Sequential(Pool((2,3), (2,3), (1,1)), Pool((2,3), (2,3), (1,1)), Pool((2,3), (2,3), (1,1), ceil_mode=True), Pool((2,3), (2,3), (1,1)), Pool((2,3), (2,3), (1,1)), Pool(3, 1, 1))
     torch_model = Sequential(MaxPool2d((2,3), (2,3), (1,1)), MaxPool2d((2,3), (2,3), (1,1)), MaxPool2d((2,3), (2,3), (1,1), ceil_mode=True), MaxPool2d((2,3), (2,3), (1,1)), MaxPool2d((2,3), (2,3), (1,1)), MaxPool2d(3, 1, 1))
     shape = [2, 3, 300, 300]
     check(jt_model, torch_model, shape, False)
     shape = [2, 3, 157, 300]
     check(jt_model, torch_model, shape, False)
     for i in range(10):
         check(jt_model, torch_model, [1,1,300,300], True)
コード例 #2
0
 def test_cpu(self):
     jt_model = jt.nn.Sequential(Pool(2, 2, 0), Pool(2, 2, 0), Pool(2, 2, 0, ceil_mode=True), Pool(2, 2, 0), Pool(2, 2, 0), Pool(3, 1, 1))
     torch_model = Sequential(MaxPool2d(2, 2, 0), MaxPool2d(2, 2, 0), MaxPool2d(2, 2, 0, ceil_mode=True), MaxPool2d(2, 2, 0), MaxPool2d(2, 2, 0), MaxPool2d(3, 1, 1))
     # shape = [64, 64, 300, 300]
     shape = [4, 64, 300, 300]
     check(jt_model, torch_model, shape, False)
     # shape = [32, 128, 157, 300]
     shape = [4, 128, 157, 300]
     check(jt_model, torch_model, shape, False)
     for i in range(10):
         check(jt_model, torch_model, [1,1,300,300], True)
コード例 #3
0
 def test_cpu_avg_pool2(self):
     from torch.nn import AvgPool2d
     jt_model = Pool(3, 1, 1, op="mean", ceil_mode=True)
     torch_model = AvgPool2d(3, 1, 1, ceil_mode=True)
     shape = (2, 16, 33, 33)
     check(jt_model, torch_model, shape, False)