Skip to content

Instantly share code, notes, and snippets.

@adityaramesh
Created October 5, 2016 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adityaramesh/e31f9bafee2a85243f1d4714fd3cb1ff to your computer and use it in GitHub Desktop.
Save adityaramesh/e31f9bafee2a85243f1d4714fd3cb1ff to your computer and use it in GitHub Desktop.
bilinear_bug.lua
require('nn')
require('nngraph')
local m
do
local x1, x2 = nn.Identity()(), nn.Identity()()
local y = nn.Bilinear(2, 2, 2){x1, x2}
m = nn.gModule({x1, x2}, {y})
end
local x1 = torch.Tensor(1, 2):fill(1)
local x2 = x1:clone()
local z = x1:clone()
print(m:forward{x1, x2})
print(m:backward({x1, x2}, z))
m:clearState()
print(m:forward{x1, x2})
print(m:backward({x1, x2}, z))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment