Skip to content

Instantly share code, notes, and snippets.

@andreaskoepf
andreaskoepf / 2d_conv_test.lua
Last active December 24, 2015 20:38
Shows that forwad and backward operations of SpatialConvolution and SpatialFullConvolution are swapped...
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()