From 41ed700550fcb5405b60375ae12e7c4ec476ad54 Mon Sep 17 00:00:00 2001 From: Matteo Presutto Date: Sat, 23 Apr 2016 18:19:45 +0200 Subject: [PATCH 1/3] identity hop shape fix --- .../deep_residual_learning/Deep_Residual_Learning_CIFAR-10.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 papers/deep_residual_learning/Deep_Residual_Learning_CIFAR-10.py diff --git a/papers/deep_residual_learning/Deep_Residual_Learning_CIFAR-10.py b/papers/deep_residual_learning/Deep_Residual_Learning_CIFAR-10.py old mode 100644 new mode 100755 index 939685a..2802ac8 --- a/papers/deep_residual_learning/Deep_Residual_Learning_CIFAR-10.py +++ b/papers/deep_residual_learning/Deep_Residual_Learning_CIFAR-10.py @@ -113,7 +113,7 @@ def residual_block(l, increase_dim=False, projection=False): block = NonlinearityLayer(ElemwiseSumLayer([stack_2, projection]),nonlinearity=rectify) else: # identity shortcut, as option A in paper - identity = ExpressionLayer(l, lambda X: X[:, :, ::2, ::2], lambda s: (s[0], s[1], s[2]//2, s[3]//2)) + identity = ExpressionLayer(l, lambda X: X[:, :, ::2, ::2], lambda s: (s[0], s[1], int(math.ceil(float(s[2])/2)), int(math.ceil(float(s[3])/2)))) padding = PadLayer(identity, [out_num_filters//4,0,0], batch_ndim=1) block = NonlinearityLayer(ElemwiseSumLayer([stack_2, padding]),nonlinearity=rectify) else: From adbe865a3410a05d7eed1f476de1ab5f755eeb12 Mon Sep 17 00:00:00 2001 From: Matteo Presutto Date: Tue, 5 Jul 2016 16:38:17 +0200 Subject: [PATCH 2/3] Update Deep_Residual_Learning_CIFAR-10.py --- .../deep_residual_learning/Deep_Residual_Learning_CIFAR-10.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/papers/deep_residual_learning/Deep_Residual_Learning_CIFAR-10.py b/papers/deep_residual_learning/Deep_Residual_Learning_CIFAR-10.py index 2802ac8..4060c32 100755 --- a/papers/deep_residual_learning/Deep_Residual_Learning_CIFAR-10.py +++ b/papers/deep_residual_learning/Deep_Residual_Learning_CIFAR-10.py @@ -113,7 +113,7 @@ def residual_block(l, increase_dim=False, projection=False): block = NonlinearityLayer(ElemwiseSumLayer([stack_2, projection]),nonlinearity=rectify) else: # identity shortcut, as option A in paper - identity = ExpressionLayer(l, lambda X: X[:, :, ::2, ::2], lambda s: (s[0], s[1], int(math.ceil(float(s[2])/2)), int(math.ceil(float(s[3])/2)))) + identity = ExpressionLayer(l, lambda X: X[:, :, ::2, ::2], lambda s: (s[0], s[1], int((s[2] + 0.5) // 2), int((s[3] + 0.5) // 2))) padding = PadLayer(identity, [out_num_filters//4,0,0], batch_ndim=1) block = NonlinearityLayer(ElemwiseSumLayer([stack_2, padding]),nonlinearity=rectify) else: From f0198fab81d0a136585a8d6dc2401181d5fe9ced Mon Sep 17 00:00:00 2001 From: Matteo Presutto Date: Tue, 5 Jul 2016 21:19:55 +0200 Subject: [PATCH 3/3] Update Deep_Residual_Learning_CIFAR-10.py --- .../deep_residual_learning/Deep_Residual_Learning_CIFAR-10.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/papers/deep_residual_learning/Deep_Residual_Learning_CIFAR-10.py b/papers/deep_residual_learning/Deep_Residual_Learning_CIFAR-10.py index 4060c32..6bd4f6d 100755 --- a/papers/deep_residual_learning/Deep_Residual_Learning_CIFAR-10.py +++ b/papers/deep_residual_learning/Deep_Residual_Learning_CIFAR-10.py @@ -113,7 +113,7 @@ def residual_block(l, increase_dim=False, projection=False): block = NonlinearityLayer(ElemwiseSumLayer([stack_2, projection]),nonlinearity=rectify) else: # identity shortcut, as option A in paper - identity = ExpressionLayer(l, lambda X: X[:, :, ::2, ::2], lambda s: (s[0], s[1], int((s[2] + 0.5) // 2), int((s[3] + 0.5) // 2))) + identity = ExpressionLayer(l, lambda X: X[:, :, ::2, ::2], lambda s: (s[0], s[1], (s[2]+1)//2, (s[3]+1)//2)) padding = PadLayer(identity, [out_num_filters//4,0,0], batch_ndim=1) block = NonlinearityLayer(ElemwiseSumLayer([stack_2, padding]),nonlinearity=rectify) else: