Last active
December 24, 2015 20:38
Revisions
-
andreaskoepf revised this gist
Dec 2, 2015 . 1 changed file with 17 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ require 'nn' x = torch.rand(1,5,5) a = nn.SpatialConvolution(1,1,3,3) a.bias:zero() ay1 =torch.xcorr2(x,a.weight,'V') ay2 = a:forward(x) b = nn.SpatialFullConvolution(1,1,3,3) b.bias:zero() by1 = torch.conv2(x, b.weight, 'F') by2 = b:forward(x) print(ay1) print(ay2) print(by1) print(by2) -
andreaskoepf revised this gist
Dec 1, 2015 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@ require 'nn' a = nn.SpatialConvolution(7,5,3,3) a.bias:zero() b = nn.SpatialFullConvolution(5,7,3,3) b.bias:zero() b.weight = a.weight test = torch.rand(7, 12, 12) @@ -16,5 +16,6 @@ y2 = b:backward(torch.zeros(5,10,10), test) z1 = a:backward(torch.zeros(7,12,12), test2) z2 = b:forward(test2) -- prints 0 twice print((y1-y2):abs():sum()) print((z1-z2):abs():sum()) -
andreaskoepf created this gist
Dec 1, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ a = nn.SpatialConvolution(7,5,3,3) a.bias:zero() b = nn.SpatialFullConvolution(5,7,3,3) require 'nn' b.bias:zero() b.weight = a.weight test = torch.rand(7, 12, 12) test2 = torch.rand(5, 10, 10) y1 = a:forward(test) y2 = b:backward(torch.zeros(5,10,10), test) z1 = a:backward(torch.zeros(7,12,12), test2) z2 = b:forward(test2) print((y1-y2):abs():sum()) print((z1-z2):abs():sum())